From f9363c16d0e6518ba82d05f1f7f415e9224a8e35 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 24 Jan 2011 15:30:14 +0000 Subject: Fix STR #2530 (Mac OS only). Implements a fast algorithm for fl_width() that memorizes the width of all characters the first time they are seen and computes the width of a string as the sum of the widths of its characters. Char widths are memorized in 256 blocks of 256 widths; only blocks used in some text are allocated and computed. The width of characters beyond U+FFFF is computed anew each time. Strings are drawn using core text, after having deactivated character kerning, so their width is the sum of the widths of their characters. This is the same algorithm as used for WIN32. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8305 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Font.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Fl_Font.H') diff --git a/src/Fl_Font.H b/src/Fl_Font.H index 65b00df8e..75478b626 100644 --- a/src/Fl_Font.H +++ b/src/Fl_Font.H @@ -63,11 +63,11 @@ public: ATSUTextLayout layout; # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 CTFontRef fontref; + // the unicode span is divided in 256 blocks of 256 characters + float *width[256]; // array of arrays of character widths # endif ATSUStyle style; short ascent, descent, q_width; -// short width[256]; -// bool knowWidths; char *q_name; int size; # elif USE_XFT -- cgit v1.2.3