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 99235 - API for getting available sizes for a face
API for getting available sizes for a face
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal normal
: 1.4.0
Assigned To: pango-maint
pango-maint
Depends on: 135235
Blocks:
 
 
Reported: 2002-11-21 23:04 UTC by Owen Taylor
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program (1.50 KB, text/plain)
2003-11-20 03:25 UTC, Noah Levitt
  Details
patch (10.52 KB, patch)
2003-11-20 03:28 UTC, Noah Levitt
none Details | Review
patch as applied (6.43 KB, patch)
2004-02-23 02:11 UTC, Noah Levitt
none Details | Review

Description Owen Taylor 2002-11-21 23:04:25 UTC
If we are interested in supporting bitmap only fonts within
the fontconfig framework (and there has been a pretty big
demand so far) it would be really nice to the available sizes
properly in the GTK+ font selector.
Comment 1 Owen Taylor 2002-11-21 23:05:01 UTC
See bug 98952 for one report.
Comment 2 Noah Levitt 2003-11-20 03:25:28 UTC
Created attachment 21635 [details]
test program
Comment 3 Noah Levitt 2003-11-20 03:28:56 UTC
Created attachment 21636 [details] [review]
patch
Comment 4 Owen Taylor 2004-02-21 16:29:02 UTC
Patch looks almost perfect. Comments I have are:

 * pango_fc_font_map_pixel_to_point_ratio() is an awkward
   name. 

 * The implementation of pixel_to_point_ratio() need some
   work.

    - The FT2 backend should be using the postscript
      72.0 instead of the "correct" 72.27
    - The Xft backend isn't going to get things right
      in the common case where the DPI has been
      overriden via X resource or XSETTINGS.

The only real way of getting the proper DPI is to
get the value of FC_DPI from a call to 
fontmap->default_substitute();  72./FC_DPI is
the right ratio.

The question is what pattern to pass to
fontmap->default_substitute and how often to call
it. I'd probably call it on 
FcPatternDuplicate (fontset->fonts[i]) once per
call to list_sizes(). The alternative, while
still calling it once per list_sizes() would be
to call it on a fixed pattern like Sans-serif 10,
which might be marginally faster.
Comment 5 Noah Levitt 2004-02-23 02:11:12 UTC
Created attachment 24680 [details] [review]
patch as applied
Comment 6 Noah Levitt 2004-02-23 02:29:44 UTC
2003-02-22  Noah Levitt  <nlevitt@columbia.edu>

	* pango/pango-font.h:
	* pango/pangofc-fontmap.c:
	* pango/pangowin32-fontmap.c: 
	* pango/fonts.c (pango_font_face_list_sizes): New API for
	getting available sizes for a bitmap font face.
Comment 7 Owen Taylor 2004-02-23 15:06:38 UTC
Couple things noticed glancing at the patch - by convention 
pango_font_face_list_sizes() should allow NULL for
sizes and/or n_sizes. Not terribly useful here but good
to be consistent. This is best taken care of in the
wrapper rather than in each implementation. 

I'd probably try to catch 

 +                  FcPatternGetDouble (tmp, FC_DPI, 0, &dpi);

failing or returning 0 and then warn and use a default value (72. 
maybe); I just don't trust fontconfig that much :-)

Finally, we need to file another bug against the win32 backend
before resolving this one to actually implemented list_sizes
for that backend.
Comment 8 Noah Levitt 2004-02-23 21:57:47 UTC
Took care of handling nulls and FcPatternGetDouble failing. Bug 135235
is for the win32 implementation.