The Trunk: TrueType-topa.40.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: TrueType-topa.40.mcz

commits-2
Tobias Pape uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-topa.40.mcz

==================== Summary ====================

Name: TrueType-topa.40
Author: topa
Time: 1 September 2015, 2:57:19.158 pm
UUID: 9abe9053-6bf7-4a8a-b769-caf1d6bbbc97
Ancestors: TrueType-topa.39

Use all glyphs in a Font, not just 256 (fix by Vasya Chajko)

=============== Diff against TrueType-topa.39 ===============

Item was changed:
  ----- Method: TTCFontReader>>processCharMap: (in category 'as yet unclassified') -----
  processCharMap: assoc
  "Process the given character map"
 
  | glyph cmap encode0 encode1 char value null |
  cmap := assoc value.
  null := (glyphs at: (cmap at: Character space asUnicode + 1) + 1) copy.
  null contours: #().
 
  encode0 := Array new: 256 withAll: glyphs first.
  encode1 := Array new: 65536 withAll: glyphs first.
 
  0 to: 255 do: [:i |
  char := Character value: i.
  glyph := glyphs at: (cmap at: char asUnicode + 1) + 1.
  encode0 at: i+1 put: glyph.
  ].
  Character separators do: [:c |
  encode0 at: (c asciiValue + 1) put: null.
  ].
  0 to: 65536 - 1 do: [:i |
  value := cmap at: i+1.
  value = 65535 ifFalse: [ "???"
  | g |
+ g := glyphs at: value+1 ifAbsent: [ null. ].
- g := glyphs at: value+1.
  (g isKindOf: TTCompositeGlyph) ifFalse: [
  encode1 at: i+1 put: g.
  ] ifTrue: [
  g basicGlyphs: (((glyphs at: value+1) basicGlyphs) collect: [:t | t key->(glyphs at: (t value glyphIndex+1))]).
  encode1 at: i+1 put: g
  ].
  ]
  ].
 
  ^ {encode0. encode1}.
  !

Item was changed:
  ----- Method: TTFontReader>>decodeCmapFmtTable: (in category 'private') -----
  decodeCmapFmtTable: entry
  | cmapFmt length entryCount segCount segments offset cmap firstCode |
  cmapFmt := entry nextUShort.
  length := entry nextUShort.
  entry skip: 2. "skip version"
 
  cmapFmt = 0 ifTrue: "byte encoded table"
  [length := length - 6. "should be always 256"
  length <= 0 ifTrue: [^ nil]. "but sometimes, this table is empty"
  cmap := Array new: length.
  entry nextBytes: length into: cmap startingAt: entry offset.
  ^ cmap].
 
  cmapFmt = 4 ifTrue: "segment mapping to deltavalues"
  [segCount := entry nextUShort // 2.
  entry skip: 6. "skip searchRange, entrySelector, rangeShift"
  segments := Array new: segCount.
  segments := (1 to: segCount) collect: [:e | Array new: 4].
  1 to: segCount do: [:i | (segments at: i) at: 2 put: entry nextUShort]. "endCount"
  entry skip: 2. "skip reservedPad"
  1 to: segCount do: [:i | (segments at: i) at: 1 put: entry nextUShort]. "startCount"
  1 to: segCount do: [:i | (segments at: i) at: 3 put: entry nextShort]. "idDelta"
  offset := entry offset.
  1 to: segCount do: [:i | (segments at: i) at: 4 put: entry nextUShort]. "idRangeOffset"
  entryCount := segments inject: 0 into: [:max :seg | max max: seg second].
  cmap := Array new: entryCount+1 withAll: 0..
  segments withIndexDo:
  [:seg :si | | code |
  seg first to: seg second do:
  [:i |
+ seg last > 0 ifTrue:
- i < 256 ifTrue:
- [seg last > 0 ifTrue:
  ["offset to glypthIdArray - this is really C-magic!!"
  entry offset: i - seg first - 1 * 2 + seg last + si + si + offset.
  code := entry nextUShort.
  code > 0 ifTrue: [code := code + seg third]]
  ifFalse:
  ["simple offset"
  code := i + seg third].
+ cmap at: i + 1 put: code"]"]].
- cmap at: i + 1 put: code]]].
  ^ cmap].
 
  cmapFmt = 6 ifTrue: "trimmed table"
  [firstCode := entry nextUShort.
  entryCount := entry nextUShort.
  cmap := Array new: entryCount + firstCode withAll: 0.
  entryCount timesRepeat:
  [cmap at: (firstCode := firstCode + 1) put: entry nextUShort].
  ^ cmap].
  ^ nil!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: TrueType-topa.40.mcz

Karl Ramberg
Hi,
Here I think it would be clearer to remove the out commented "]" !

Karl

On Tue, Sep 1, 2015 at 2:57 PM, <[hidden email]> wrote:
Tobias Pape uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-topa.40.mcz

==================== Summary ====================

Name: TrueType-topa.40
Author: topa
Time: 1 September 2015, 2:57:19.158 pm
UUID: 9abe9053-6bf7-4a8a-b769-caf1d6bbbc97
Ancestors: TrueType-topa.39

Use all glyphs in a Font, not just 256 (fix by Vasya Chajko)

=============== Diff against TrueType-topa.39 ===============

Item was changed:
  ----- Method: TTCFontReader>>processCharMap: (in category 'as yet unclassified') -----
  processCharMap: assoc
        "Process the given character map"

        | glyph cmap encode0 encode1 char value null |
        cmap := assoc value.
        null := (glyphs at: (cmap at: Character space asUnicode + 1) + 1) copy.
        null contours: #().

        encode0 := Array new: 256 withAll: glyphs first.
        encode1 := Array new: 65536 withAll: glyphs first.

        0 to: 255 do: [:i |
                char := Character value: i.
                glyph := glyphs at: (cmap at: char asUnicode + 1) + 1.
                encode0 at: i+1 put: glyph.
        ].
        Character separators do: [:c |
                encode0 at: (c asciiValue + 1) put: null.
        ].
        0 to: 65536 - 1 do: [:i |
                value := cmap at: i+1.
                value = 65535 ifFalse: [ "???"
                        | g |
+                       g := glyphs at: value+1 ifAbsent: [ null. ].
-                       g := glyphs at: value+1.
                        (g isKindOf: TTCompositeGlyph) ifFalse: [
                                encode1 at: i+1 put: g.
                        ] ifTrue: [
                                g basicGlyphs: (((glyphs at: value+1) basicGlyphs) collect: [:t | t key->(glyphs at: (t value glyphIndex+1))]).
                                encode1 at: i+1 put: g
                        ].
                ]
        ].

        ^ {encode0. encode1}.
  !

Item was changed:
  ----- Method: TTFontReader>>decodeCmapFmtTable: (in category 'private') -----
  decodeCmapFmtTable: entry
        | cmapFmt length entryCount segCount segments offset cmap firstCode |
        cmapFmt := entry nextUShort.
        length := entry nextUShort.
        entry skip: 2. "skip version"

        cmapFmt = 0 ifTrue: "byte encoded table"
                [length := length - 6.          "should be always 256"
                length <= 0 ifTrue: [^ nil].    "but sometimes, this table is empty"
                cmap := Array new: length.
                entry nextBytes: length into: cmap startingAt: entry offset.
                ^ cmap].

        cmapFmt = 4 ifTrue: "segment mapping to deltavalues"
                [segCount := entry nextUShort // 2.
                entry skip: 6. "skip searchRange, entrySelector, rangeShift"
                segments := Array new: segCount.
                segments := (1 to: segCount) collect: [:e | Array new: 4].
                1 to: segCount do: [:i | (segments at: i) at: 2 put: entry nextUShort]. "endCount"
                entry skip: 2. "skip reservedPad"
                1 to: segCount do: [:i | (segments at: i) at: 1 put: entry nextUShort]. "startCount"
                1 to: segCount do: [:i | (segments at: i) at: 3 put: entry nextShort]. "idDelta"
                offset := entry offset.
                1 to: segCount do: [:i | (segments at: i) at: 4 put: entry nextUShort]. "idRangeOffset"
                entryCount := segments inject: 0 into: [:max :seg | max max: seg second].
                cmap := Array new: entryCount+1 withAll: 0..
                segments withIndexDo:
                        [:seg :si | | code |
                        seg first to: seg second do:
                                [:i |
+                                       seg last > 0 ifTrue:
-                               i < 256 ifTrue:
-                                       [seg last > 0 ifTrue:
                                                ["offset to glypthIdArray - this is really C-magic!!"
                                                entry offset: i - seg first - 1 * 2 + seg last + si + si + offset.
                                                code := entry nextUShort.
                                                code > 0 ifTrue: [code := code + seg third]]
                                        ifFalse:
                                                ["simple offset"
                                                code := i + seg third].
+                                       cmap at: i + 1 put: code"]"]].
-                                       cmap at: i + 1 put: code]]].
                ^ cmap].

        cmapFmt = 6 ifTrue: "trimmed table"
                [firstCode := entry nextUShort.
                entryCount := entry nextUShort.
                cmap := Array new: entryCount + firstCode withAll: 0.
                entryCount timesRepeat:
                        [cmap at: (firstCode := firstCode + 1) put: entry nextUShort].
                ^ cmap].
        ^ nil!





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: TrueType-topa.40.mcz

Tobias Pape

On 01.09.2015, at 19:18, karl ramberg <[hidden email]> wrote:

> Hi,
> Here I think it would be clearer to remove the out commented "]" !

Yes, I missed that, sorry.

>
> Karl
>
> On Tue, Sep 1, 2015 at 2:57 PM, <[hidden email]> wrote:
> Tobias Pape uploaded a new version of TrueType to project The Trunk:
> http://source.squeak.org/trunk/TrueType-topa.40.mcz
>
> ==================== Summary ====================
>
> Name: TrueType-topa.40
> Author: topa
> Time: 1 September 2015, 2:57:19.158 pm
> UUID: 9abe9053-6bf7-4a8a-b769-caf1d6bbbc97
> Ancestors: TrueType-topa.39
>
> Use all glyphs in a Font, not just 256 (fix by Vasya Chajko)
>
> =============== Diff against TrueType-topa.39 ===============
>
> Item was changed:




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: TrueType-topa.40.mcz

Karl Ramberg
Thanks :-)

Karl

On Tue, Sep 1, 2015 at 8:13 PM, Tobias Pape <[hidden email]> wrote:

On 01.09.2015, at 19:18, karl ramberg <[hidden email]> wrote:

> Hi,
> Here I think it would be clearer to remove the out commented "]" !

Yes, I missed that, sorry.

>
> Karl
>
> On Tue, Sep 1, 2015 at 2:57 PM, <[hidden email]> wrote:
> Tobias Pape uploaded a new version of TrueType to project The Trunk:
> http://source.squeak.org/trunk/TrueType-topa.40.mcz
>
> ==================== Summary ====================
>
> Name: TrueType-topa.40
> Author: topa
> Time: 1 September 2015, 2:57:19.158 pm
> UUID: 9abe9053-6bf7-4a8a-b769-caf1d6bbbc97
> Ancestors: TrueType-topa.39
>
> Use all glyphs in a Font, not just 256 (fix by Vasya Chajko)
>
> =============== Diff against TrueType-topa.39 ===============
>
> Item was changed: