[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] GF's cmap fails
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] GF's cmap fails |
Date: |
Tue, 21 Aug 2018 08:44:32 +0200 (CEST) |
>> GF provides a natural order of glyphs within the font file, we call
>> this `glyph indices'. Each glyph index is associated with a file
>> offset. For each glyph, GF assigns a character code to it. We
>> thus have immediately a mapping from glyph indices to character
>> codes.
>
> My changes to `cmap' were done to load glyphs in the order they
> appear in the font file,
This is OK.
> as the `gf driver' uses the offsets taken from the `char_loc'
> commands in the `gf' file to get the metrics,
Yes.
> now when the driver goes in the loop to get all the `char_loc'
> values ( the chardx and chardy values ), it loads the glyphs in the
> order they appear in the `char_loc' command,
Well, the glyphs aren't `loaded'; you are rather collecting the file
offsets in an array.
> which is different from the order they appear in the font file.
Yes.
> It loads glyphs in the increasing order of their character code.
Not necessarily: The order of `char_loc' commands could be arbitrary,
say,
Character 3: dx 3801088 (58), width 728179 (57.65427), loc 11007
Character 4: dx 3604480 (55), width 699053 (55.34819), loc 11226
Character 0: dx 3407872 (52), width 655362 (51.88892), loc 10368
Character 1: dx 4521984 (69), width 873816 (69.18521), loc 10521
Character 2: dx 4259840 (65), width 815562 (64.57289), loc 10736
Character 5: dx 4063232 (62), width 786434 (62.26666), loc 11365
> Now, what I did is, I took the offsets and sorted them and then in
> the same order loaded the `glyph indices' thus fulfilling the goal.
Yes.
> And as the `indices table' is formed in such a way, it will remain
> unsorted,
You have to do sorting again! I wrote in my last e-mail that you need
*two* *separate* arrays so that you can replace the `linear searching'
with accessing a pre-sorted array instead.
>> [For simplicity, I'm ignoring the still missing artificial glyphs
>> that must be inserted at glyph indices 0 and 1, as mentioned in a
>> previous e-mail.]
>
> This is in the pipeline and will be added soon :-)
Very good.
Werner