Opened 6 years ago

Closed 5 years ago

#703 closed defect (discarded)

gtk-version does not respect fixed-font-width property of GCs

Reported by: westram Owned by: devel
Priority: normal Milestone:
Component: Library (GUI) Version: gtkport
Keywords: monospace edit4 Cc:

Description

problematic in arb_edit4:

Sequence display gets completely corrupted if a variable-width font is selected as sequence font.
Most likely happens because editor uses fixed-width spaces to speed up colored sequence display.

Other clients do not seem to be affected by that problem.

Change History (7)

comment:1 follow-up: Changed 6 years ago by epruesse

The problem is that the GTK 2 font chooser does not allow limiting the displayed choices to the fonts that are monospaced. :/

Options I see:

  • move to GTK 3 which IIRC has a font chooser that can limit to monospace fonts
  • implement mono-spacing ourselves (i.e. create a a glyph string manually, rather than having it made by pango)

comment:2 in reply to: ↑ 1 Changed 6 years ago by westram

Replying to epruesse:

Options I see:

Another option would be to test (after font-change) whether the font is monospaced and to warn if it isn't.

comment:3 follow-up: Changed 6 years ago by epruesse

That could end up being rather tedious for the user — you'll often have a lot of fonts, very few of which are monospaced.

Also, and perhaps more importantly, placing the letters "manually" without consideration of kerning, direction, etc. will be significantly faster.

I don't recall exactly, but I thought I did something like that already. Maybe I didn't get around to finishing it.

comment:4 in reply to: ↑ 3 Changed 6 years ago by westram

Replying to epruesse:

Also, and perhaps more importantly, placing the letters "manually" without consideration of kerning, direction, etc. will be significantly faster.

Ah ok, that's a good point.

I don't recall exactly, but I thought I did something like that already. Maybe I didn't get around to finishing it.

Most likely. At least using a non-monospace font looks weirdo 8-O

comment:5 follow-up: Changed 6 years ago by epruesse

I just checked. I do build the glyph strings by hand to speed things up. Only if all characters are "ascii" (safe and easy and catches most things), but that should be enough for the editor.

The glyphs for all ascii characters as well as their width, ascent and descent are loaded in AW_common_impl.cxx:AW_GC_gtk::wm_set_font(). A second run over prvt→ascii_glyphs[i], setting .geometry.width to max(geometry.width) and fixing .geometry.x_offset so that the characters are centered in their cells should do it.

comment:6 in reply to: ↑ 5 Changed 6 years ago by westram

Replying to epruesse:

The glyphs for all ascii characters as well as their width, ascent and descent are loaded in AW_common_impl.cxx:AW_GC_gtk::wm_set_font(). A second run over prvt→ascii_glyphs[i], setting .geometry.width to max(geometry.width) and fixing .geometry.x_offset so that the characters are centered in their cells should do it.

Ok, thx for checking.
I need to work on AW_common for #704, but that'll need another gtk↔motif sync-orgy :-?

comment:7 Changed 5 years ago by westram

  • Resolution set to discarded
  • Status changed from new to closed

gtk-port is dead

Note: See TracTickets for help on using tickets.