> I believe Fl_Quartz_Graphics_Driver::width(unsigned int wc)
> is very seldom used because in most situations, one has to measure
> a string and not a single character. In FLTK, it's used only in
> Fl_Help_View to measure the space character.
> 
> If conversion from a single UTF32 character to UTF16
> is useful for Fl_GDI_Graphics_Driver::width(const char* c, int n),
> a new function could be useful. But if it's used only in
> Fl_GDI_Graphics_Driver::width(unsigned int wc), I don't think
> it's justified.


That may be so for the OSX portions, but the fl_font_win32 version of
::width(unsigned int wc) probably gets used a lot.

In particular, ::width(const char* c, int n) works by calling
::width(unsigned int c) repeatedly for each glyph in the string (and
::width(unsigned int c) does not handle surrogate pairs correctly at
all.)

Also, the win32 version of ::draw(const char* str, int n, int x, int y)
attempts to render the text by calling TextOutW() repeatedly on a per
glyph basis, then uses ::width(unsigned int c) to determine how far to
advance the render position for the next glyph.
This too is therefore broken for surrogate pairs.

Probably ::draw(const char* str, int n, int x, int y) ought to call
TextOutW() for the entire string (indeed, this is what ::draw(int angle,
const char* str,...) does, so why the non-angle version is different I
am not sure, presumably historical?
I note that ::rtl_draw(...) also renders the entire string in one go, so
it is probably the better way to handle things anyway!



SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to