Bug 7767 - cairo re-embeds fonts for every size in PS and PDF
Summary: cairo re-embeds fonts for every size in PS and PDF
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.2.1
Hardware: x86 (IA32) All
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-04 07:11 UTC by Adrian Johnson
Modified: 2007-02-23 03:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch (6.26 KB, patch)
2006-08-22 06:54 UTC, Adrian Johnson
Details | Splinter Review
Patch (4.89 KB, patch)
2006-08-23 05:40 UTC, Adrian Johnson
Details | Splinter Review

Description Adrian Johnson 2006-08-04 07:11:16 UTC
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.
Comment 1 Adrian Johnson 2006-08-22 06:54:05 UTC
Created attachment 6646 [details] [review]
Patch

This patch combines scaled fonts with the same face into the one subset.
Comment 2 Behdad Esfahbod 2006-08-22 11:21:31 UTC
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?
Comment 3 Adrian Johnson 2006-08-23 05:40:30 UTC
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.
Comment 4 Behdad Esfahbod 2006-08-23 10:34:07 UTC
(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.
Comment 5 Adrian Johnson 2006-08-24 02:12:48 UTC
> 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.