After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 169020 - font_from_pango_font should handle FC_PIXEL_SIZE
font_from_pango_font should handle FC_PIXEL_SIZE
Status: RESOLVED FIXED
Product: gnome-print
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2005-03-02 20:34 UTC by Owen Taylor
Modified: 2005-07-20 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Original suggestion as a real patch (2.00 KB, patch)
2005-07-20 14:53 UTC, Owen Taylor
accepted-commit_now Details | Review

Description Owen Taylor 2005-03-02 20:34:54 UTC
If you set an absolute size for a font (with Pango-1.8) you'll
get a FcPattern with FC_PIXEL_SIZE set not FC_SIZE. So, 
gnome-print-pango.c:font_from_pango_font() should, after checking
for FC_SIZE, check again for FC_PIXEL_SIZE if the FC_SIZE
check fails. 

So something like:

-        if (FcPatternGetDouble (fcfont->font_pattern, FC_SIZE, 0, &size) !=
FcResultMatch)
-                return NULL;
+         result = FcPatternGetDouble (fcfont->font_pattern, FC_SIZE, 0, &size);
+         if (result == FcResultNoMatch)
+            result = FcPatternGetDouble (fcfont->font_pattern, FC_PIXEL_SIZE,
0, &size);
+         if (result != FcResultMatch)
+            return NULL;
            
The resolution is 72 for the fontmap so FC_SIZE and FC_PIXEL_SIZE can
be treated identically.
Comment 1 Jody Goldberg 2005-03-10 15:50:42 UTC
done.  Patch will be in 2.10.1
thanks
Comment 2 Owen Taylor 2005-07-20 14:45:47 UTC
Hmm, the applied patch doesn't work:

        if (FcPatternGetDouble (fcfont->font_pattern, FC_SIZE, 0, &size) !=
FcResultMatch)
+               return NULL;
+       if (FcPatternGetDouble (fcfont->font_pattern, FC_SIZE, 0, &size) !=
FcResultMatch &&
+           FcPatternGetDouble (fcfont->font_pattern, FC_PIXEL_SIZE, 0, &size)
!= FcResultMatch)
                return NULL;

That reads "bail out if FC_SIZE is not there. Then Bail out if FC_SIZE
and FC_PIXEL_SIZE are both not there"

Right now Pango head is only setting FC_PIXEL_SIZE, resulting in printing
not working ... I'll put a workaround to set FC_SIZE in the pattern as
well, at a small cost in efficiency.
Comment 3 Owen Taylor 2005-07-20 14:53:04 UTC
Created attachment 49467 [details] [review]
Original suggestion as a real patch

Here's my suggestion as a patch, tested to work.

(Serves me write for doing a pseudo-patch the first time...)
Comment 4 Owen Taylor 2005-07-20 15:21:19 UTC
Committed (HEAD and gnome-2-10)

2005-07-20  Owen Taylor  <otaylor@redhat.com>

        * libgnomeprint/gnome-print-pango.c: Redo the code that looks
        for FC_PIXEL_SIZE; the previous fix for bug #169020 wasn't
        quite right.