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 313742 - GtkTextView text issues with incorrect font setting
GtkTextView text issues with incorrect font setting
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: win32
1.10.x
Other Windows
: Normal minor
: Small fix
Assigned To: gtk-win32 maintainers
pango-maint
Depends on:
Blocks:
 
 
Reported: 2005-08-17 17:58 UTC by Joseph Turner
Modified: 2018-05-22 12:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source, executable of issue (264.42 KB, application/octet-stream)
2006-01-02 12:38 UTC, Joseph Turner
Details
Source/executables to replicate issue. (288.35 KB, application/octet-stream)
2006-01-02 14:40 UTC, Joseph Turner
Details
Sample code to show the bug (1.69 KB, text/plain)
2011-10-13 06:34 UTC, Miroslav Rajcic
Details

Description Joseph Turner 2005-08-17 17:58:34 UTC
Please describe the problem:
With a GTK Source View widget, if one sets the font to one that doesn't exist;
pressing the Enter does not advance existing text down a line. The issue appears
to be due to crlf not being correctly managed. 
If you enable line numbers on the LHS of the GTKSourceview, these play up too.
* The fix to the problem was to put in a font that existed.

* None of these problems were observed under Linux.

Steps to reproduce:
1.Modify code... 
  pfd = pango_font_description_from_string("Some random font name");
  gtk_widget_modify_font(GTK_WIDGET(sourceview), pfd);
2. recompile
3. Run and press enter in the gtksourceview.


Actual results:
no new lines generated in gtksourceview when pressing enter

Expected results:
new lines be generated in gtksourceview

Does this happen every time?
yes

Other information:
Comment 1 Owen Taylor 2005-08-17 20:21:41 UTC
If you can reproduce with a plain GtkTextView, reassign to GTK+. If 
someone tracks it down in GTK+ and it's a Pango problem, then reassign
to Pango.
Comment 2 Jeroen Zwartepoorte 2005-08-23 12:59:22 UTC
Possible bugs in GtkSourceView/GtkTextView aside, shouldn't pango complain when
you try to create a new PangoFontDescription with a font string that doesn't exist?
Comment 3 Owen Taylor 2005-08-23 13:40:13 UTC
Because of the nature of fontconfig, Pango has no idea whether a font exists
or not ... you give fontconfig a font name, it will give you a font back.
the font name might be an alias, it might be a real font on the system,
it might have ignored the name because it wasn't found and given you some
random font matching the other fields.
Comment 4 Paolo Maggi 2005-12-30 17:24:02 UTC
Joseph: you said "None of these problems were observed under Linux.". On which OS you observed them?

Could you please try to reproduce this problem modifying the testtext program you  find in gtk+/tests? 
Comment 5 Joseph Turner 2006-01-02 12:32:56 UTC
ok.
Platform: WINDOWS - observed under windows 2000 and XP, no idea about other Windows platforms.
I've always had problems compiling the test cases under windows. so instead I've created a program to replicate this issue (source and binary). Please find it as an attachment. Will also need to download gtk for windows. http://leederville.net/~joeman/gtk+-2.6.9-setup.exe.
Comment 6 Joseph Turner 2006-01-02 12:38:49 UTC
Created attachment 56661 [details]
source, executable of issue

Run the application test.exe - DO the following to replicate the issues
First line type 'happy'  (hit enter)
Second line type 'days'  (press the up key to go to previous line and go to end 
                          of first line)
Enter some more text on first line (hit enter)  
You should see the numbers mucked up on the LHS.
Comment 7 Joseph Turner 2006-01-02 14:40:01 UTC
Created attachment 56668 [details]
Source/executables to replicate issue.

Able to replicate issue using textview widget instead of sourceview widget. Will reassign and change component. Please see attachment - test1.* the textview versions.
Comment 8 Paolo Maggi 2006-01-02 14:53:41 UTC
Since Joseph has beed able to reproduce this bug without GtkSoureView, I'm going to change the produce to gtk+/GtkTextView
Comment 9 Paolo Maggi 2006-01-02 14:56:03 UTC
paolo joe: which version of gtk+/pango are you using?
joe pango 1.8.2
joe gtk+ 2.6.9
Comment 10 Paolo Borelli 2006-01-11 13:08:34 UTC
the issue is specific to win32
Comment 11 Tor Lillqvist 2006-02-10 13:17:13 UTC
Hmm, isn't this a case of garbage in, garbage out...?

Most probably the problem is in Pango, not GTK+
Comment 12 Behdad Esfahbod 2006-02-10 19:31:52 UTC
AFAIU with PangoX and PangoWin32 backends, if no font exists, a font metrics of all zero is returned.  Since fallback seems to be broken on Win32, this is probably what's happening.
Comment 13 Tor Lillqvist 2006-02-10 22:02:51 UTC
Do you mean some backend-specific fallback mechanism? I don't think there has ever been such in pangowin32.

Or do you mean that the generic fallback mechanism doesn't work with the pangowin32 backend? That is not entirely true, inputting printable letters or lines with just whitespace (at least one space) in the test program does work. (And produces the warning 'couldn't load font "Foobar 8", falling back to "Sans 8", expect ugly output.' It's completely empty lines in the textview that don't make use of the Sans 8 fallback for some reason and are then apparently measured as zero.
Comment 14 Owen Taylor 2006-02-11 15:14:37 UTC
Sounds like pango_layout_line_get_empty_extents() might have a 
win32-specific issues?

Comment 15 Tor Lillqvist 2006-02-11 16:55:04 UTC
Probably. Isn't it backend-independend code that falls back to "Sans 8" instead of "Foobar 8" for non-empty lines, though? Why doesn't this happen for empty lines?
Comment 16 Behdad Esfahbod 2006-02-12 20:57:26 UTC
Here is the reason:

The "Sans" fallback happens in pango_font_map_load_fontset, while pango_layout_line_get_empty_extents calls pango_context_load_font which in turn calls pango_font_map_load_font (not fontset), which is backend-specific and does not fallback to Sans or anything.  And apparently we have if (font) ... else logical_rect->height = 0 in empty_extents.

The way the FcFontMap works it that it implements load_font as get_first_font (load_fontset).  That's why you get all those fallbacks and all.  Any chance Win32 can be changed to do the same?
Comment 17 Tor Lillqvist 2006-02-12 23:00:47 UTC
See also discussion in bug #310700
Comment 18 Miroslav Rajcic 2011-10-13 06:27:47 UTC
I just wanted to report the practically the same bug, but I've managed to find this report. See attachment for the sample code.

In my test code, this bug appears only on Windows (GTK 2.22.0).
Tested on Linux too using Fedora 12 (GTK 2.18.6) and Ubuntu 11.04 (GTK 2.24.x) but the bug does not seem to be present there.

To reproduce the bug: go to the end of any text line and press Enter, nothing happens, new line does not seem to be added.

I'd personally vote to give this bug the highest priority because it destroys the usage of the text editing when two users exchange formatted documents, and one user not having all the the fonts used in the document.
Comment 19 Miroslav Rajcic 2011-10-13 06:34:23 UTC
Created attachment 198911 [details]
Sample code to show the bug
Comment 20 GNOME Infrastructure Team 2018-05-22 12:11: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/29.