Cairo re-embeds a subsetted font for every size of every font used in the PS and PDF backends. This occurs with truetype, type1, and outline type 3 fonts.
Created attachment 6646 [details] [review] Patch This patch combines scaled fonts with the same face into the one subset.
Thanks Adrian! I'm not quite sure how this works for Type3 fonts, specially with respect to hinting and scale, but I'll test further. From a quick look, this doesn't look right: - sub_font->sub_font_glyphs = _cairo_hash_table_create (_cairo_sub_font_glyphs_equal); + if (parent->merge_scaled) + sub_font->sub_font_glyphs = _cairo_hash_table_create (_cairo_sub_font_glyphs_equal); + sub_font->sub_font_glyphs = _cairo_hash_table_create (_cairo_sub_font_glyphs_equal); I also think you don't need a separate equal/hash function for the merged case. Just keeping a pointer version of base.hash should be enough. I mean, no font_face_t and scaled_font_t have the same address, right?
Created attachment 6657 [details] [review] Patch I have rearranged the patch a bit. It has been tested with truetype, type1, and type 3 fonts. There is no problem with hinting and scale of type 3 fonts as the PS/PDF backends turn off hinting and the FontMatrix in the type 3 font dictionary is the inverse of the scaled font it was created from.
(In reply to comment #3) > Created an attachment (id=6657) [edit] > Patch > > I have rearranged the patch a bit. It has been tested with truetype, type1, and > type 3 fonts. Thanks. > There is no problem with hinting and scale of type 3 fonts as the PS/PDF > backends turn off hinting A user still can be setting hinting on. I agree that fonts hinted to 1pt boundaries are not that useful, but they are possible currently, and we use enable metrics hinting in the test suite for example. Not sure how that will be affected. > and the FontMatrix in the type 3 font dictionary is > the inverse of the scaled font it was created from.
> A user still can be setting hinting on. I agree that fonts hinted to 1pt > boundaries are not that useful, but they are possible currently, and we use > enable metrics hinting in the test suite for example. Not sure how that > will be affected. After some further testing I can see I misunderstood how the font options work. Another problem is this will not work for bitmap fonts. I'm open to suggestions.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.