Skip to content

Commit

Permalink
font-patcher: Preserve existing bitmaps
Browse files Browse the repository at this point in the history
[why]
Bitmaps existing in a font are discarded. The font-patcher script just
cares about outline fonts.

[how]
If the sourcefont has bitmaps, do save them into the patched font. Note
that this does not generate bitmaps for the patched-in glyphs (icons).

[note]
Fonts probably affected in src/unpatched-fonts:
    bitmap (11,) (gohufont-11)
    bitmap (14,) (gohufont-14)
    bitmap (11,) (gohufont-uni-11)
    bitmap (14,) (gohufont-uni-14)
    bitmap (7, 9, 10, 12, 14, 18, 24) (ProFontIIx)
    bitmap (12, 14, 16, 18, 20, 22, 24, 28, 32) (TerminusTTF-Bold Italic-4.40.1)
    bitmap (12, 14, 16, 18, 20, 22, 24, 28, 32) (TerminusTTF-Bold-4.40.1)
    bitmap (12, 14, 16, 18, 20, 22, 24, 28, 32) (TerminusTTF-Italic-4.40.1)
    bitmap (12, 14, 16, 18, 20, 22, 24, 28, 32) (TerminusTTF-4.40.1)

Fixes: ryanoasis#86

Reported-by: DoctorKnowsBetter
Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Sep 24, 2022
1 parent 320623f commit a593e85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ class font_patcher:
fontname = sourceFont.cidfontname
outfile = os.path.normpath(os.path.join(self.args.outputdir, fontname + self.args.extension))
# the `PfEd-comments` flag is required for Fontforge to save '.comment' and '.fontlog'.
sourceFont.generate(outfile, flags=(str('opentype'), str('PfEd-comments')))
bitmaps = str()
if len(self.sourceFont.bitmapSizes):
print("Preserving bitmaps {}".format(self.sourceFont.bitmapSizes))
bitmaps = str('otf') # otf/ttf, both is bf_ttf
sourceFont.generate(outfile, bitmap_type=bitmaps, flags=(str('opentype'), str('PfEd-comments')))
message = "\nGenerated: {} in '{}'".format(self.sourceFont.fullname, outfile)

# Adjust flags that can not be changed via fontforge
Expand Down

0 comments on commit a593e85

Please sign in to comment.