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 455940 - empty lines have height 0
empty lines have height 0
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: win32
1.17.x
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
pango-maint
: 559014 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-07-11 15:17 UTC by Peter Frentrup
Modified: 2018-05-22 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program (2.36 KB, text/plain)
2009-11-04 10:09 UTC, Tor Lillqvist
Details
minimal testcase (1.90 KB, text/x-csrc)
2009-11-04 17:44 UTC, Peter Frentrup
Details

Description Peter Frentrup 2007-07-11 15:17:05 UTC
Please describe the problem:
When I lay out text that contains empty lines and the layout object has a font description with more than one font familiy, the empty lines will have height zero.

Steps to reproduce:
/* create and init caito_t *cr, PangoLayout *layout ... */
PangoFontDescription *desc = pango_font_description_from_string("Times,Arial 20");
pango_layout_set_font_description(layout, desc);
pango_font_description_free(desc);

pango_layout_set_text(layout,"LINE 1\n\nLINE 3",-1);

pango_cairo_show_layout(cr,layout);

Actual results:
The layout's font description contains 2 fonts (Times and Arial) with size 20.
The output is:
LINE 1
LINE 3


Expected results:
The output should be:
LINE 1

LINE 3

Does this happen every time?
Yes, it happens every time when more than one font family is given. It does not happen at all when only one font family is given.

Other information:
I am using Pango 1.17.3 on Windows.
Comment 1 Behdad Esfahbod 2007-07-18 16:27:54 UTC
Works on Linux.  Bug 457990 may be relevant.
Comment 2 Tor Lillqvist 2009-11-04 09:29:42 UTC
Peter, is this still a problem? If it is, could you please provide a *complete* and *minimal* test program, thanks.
Comment 3 Tor Lillqvist 2009-11-04 09:49:20 UTC
*** Bug 559014 has been marked as a duplicate of this bug. ***
Comment 4 Tor Lillqvist 2009-11-04 10:02:51 UTC
There was a nice test program in bug #559014, attaching it here, slightly simplified.
Comment 5 Tor Lillqvist 2009-11-04 10:09:05 UTC
Created attachment 146903 [details]
Test program

Run with a font family name as the command-line argument. Try with "Courier", "Courier New" and "Arial" for instance. Note that for "Courier" the blank lines have zero height, but not for "Courier New" not. (This is on WS2008R2, i.e. Windows 7, at least.) Interesting. OTOH in the Windows 7 Control Panel's  Fonts thingie, I don't even see any font called just "Courier", but instead "Courier Regular", in addition to "Courier New". Hmmm.
Comment 6 Tor Lillqvist 2009-11-04 10:15:59 UTC
Actually I am not sure whether bug #559014 is a duplicate or not. The code is different, here you use pango_font_description_from_string() and then pango_layout_set_font_description() while the test program above, from that other bug, uses pango attribute lists. Probably this just eventually ends up in the same code paths, though.

Anyway, Peter, part of your problem is presumably that you assume there is a font called "Times" while it actually is called "Times New Roman". Does it help for you if you use "times new roman,arial 20" instead of "times,arial 20" ?

Also, it is a known problem that the Windows font code in Pango doesn't accept lists of font families in the same situations where the fontconfig-based one used on X11 does. There is some separate bug already filed for that.
Comment 7 Tor Lillqvist 2009-11-04 10:29:27 UTC
The font name "courier" is taken care of by the built-in aliases list "builtin_aliases" in pango-utils.c, used on Windows. It has
 
  "courier = \"courier new\"",

I still don't understand why this causes the effect described in comment #5, though.

Also interesting is that the aliases list has both

  "mono = \"dejavu sans mono,courier new,lucida console,courier monothai,mingliu,simsun,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\"",

and

  "monospace = \"dejavu sans mono,courier new,lucida console,courier monothai,mingliu,simsun,gulimche,ms gothic,sylfaen,kartika,latha,mangal,raavi\""

i.e. exactly the same list as alias for "mono" and "monospace". Still running the test program with "mono" and "monospace" produces different results. Weird.
Comment 8 Peter Frentrup 2009-11-04 17:44:55 UTC
Created attachment 146932 [details]
minimal testcase

example:
main.exe out.png "Times New Roman,Courier New 20"

console output:
Test case for Pango Bug 455940
Pango version: 1.26.0
using font description "Times New Roman,Courier New 20"
with text:
"LINE 1

LINE 3"

height (pango units): 63488
Comment 9 Peter Frentrup 2009-11-04 17:48:32 UTC
#6: The second line has heigt zero in both cases "Times,Arial 20" and "Times New Roman,Arial 20"

#7: With "mono 20" the second line also has height zero, but with "monospace 20" it has the correct dimensions

(I am currently using Windows Vista SP 1)
Comment 10 Tobias Mueller 2010-02-27 13:18:58 UTC
Reopening as the requested information has been provided.
Comment 11 wedge009 2016-02-15 11:59:29 UTC
This bug appears to be still outstanding as of 2016-02-15, using pango 1.39.0 under Windows (at least 7 through to 10). I observe exactly the same symptoms as the original reporter, downstream bug report at https://gna.org/bugs/?21649

Stack trace is below:
libpangowin32-1.0-0.dll!pango_win32_font_map_load_font(_PangoFontMap * fontmap, _PangoContext * context, const _PangoFontDescription * description) Line 882	C
libpango-1.0-0.dll!pango_font_map_load_font(_PangoFontMap * fontmap, _PangoContext * context, const _PangoFontDescription * desc) Line 95	C
libpango-1.0-0.dll!pango_context_load_font(_PangoContext * context, const _PangoFontDescription * desc) Line 319	C
libpango-1.0-0.dll!pango_layout_get_empty_extents_at_index(_PangoLayout * layout, int index, _PangoRectangle * logical_rect) Line 4550	C
libpango-1.0-0.dll!pango_layout_line_get_empty_extents(_PangoLayoutLine * line, _PangoRectangle * logical_rect) Line 4590	C
libpango-1.0-0.dll!pango_layout_line_get_extents(_PangoLayoutLine * line, _PangoRectangle * ink_rect, _PangoRectangle * logical_rect) Line 4819	C
libpango-1.0-0.dll!get_line_extents_layout_coords(_PangoLayout * layout, _PangoLayoutLine * line, int layout_width, int y_offset, int * baseline, _PangoRectangle * line_ink_layout, _PangoRectangle * line_logical_layout) Line 2550	C
libpango-1.0-0.dll!pango_layout_get_extents_internal(_PangoLayout * layout, _PangoRectangle * ink_rect, _PangoRectangle * logical_rect, _GSList * * line_extents) Line 2661	C
libpango-1.0-0.dll!pango_layout_get_extents(_PangoLayout * layout, _PangoRectangle * ink_rect, _PangoRectangle * logical_rect) Line 2785	C
libpango-1.0-0.dll!pango_layout_get_pixel_extents(_PangoLayout * layout, _PangoRectangle * ink_rect, _PangoRectangle * logical_rect) Line 2811	C

We are using font family "DejaVu Sans,Andagii,Droid Sans Japanese,Droid Sans Fallback,Junicode", where all except Junicode are provided as part of the software package. Is there a work around available? I'm not sure about the last paragraph of comment 6 - is this a situation where we should not be using a list of font families under Windows?

Thanks for your time and help.
Comment 12 Behdad Esfahbod 2016-03-11 10:43:07 UTC
Ouch!  I don't have access to Windows.  Anyone who can debug this?  Thanks.
Comment 13 GNOME Infrastructure Team 2018-05-22 12:30:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/84.