summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-01-24 20:05:34 +0000
committerManolo Gouy <Manolo>2011-01-24 20:05:34 +0000
commite3a96057c11c715e61f4b2fe1f29d9a11d1fff26 (patch)
tree642c33a3fbd532b5b56bada7615e8e0994f13a61 /src
parent5824eb4eb955815e2012774836ffd33fad622411 (diff)
Fix STR #2530 (Mac OS only)-continued. Use 512 blocks of 128 character widths
(instead of 256x256) because this reduces greatly the opening time of windows with several new fonts. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8309 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Font.H4
-rw-r--r--src/fl_font_mac.cxx10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/Fl_Font.H b/src/Fl_Font.H
index 75478b626..950d2e3b0 100644
--- a/src/Fl_Font.H
+++ b/src/Fl_Font.H
@@ -63,8 +63,8 @@ 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
+ // the unicode span is divided in 512 blocks of 128 characters
+ float *width[512]; // array of arrays of character widths
# endif
ATSUStyle style;
short ascent, descent, q_width;
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 291647086..10285129b 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -312,15 +312,15 @@ if (fl_mac_os_version >= 0x1050) {
i++; // because a pair of UniChar's represent a single character
continue;
}
- unsigned int r = uni >> 8; // index of the character block containing uni
+ unsigned int r = uni >> 7; // index of the character block containing uni
if (!fl_fontsize->width[r]) { // this character block has not been hit yet
//fprintf(stderr,"r=%d size=%d name=%s\n",r,fl_fontsize->size, fl_fontsize->q_name);
// allocate memory to hold width of each character in the block
- fl_fontsize->width[r] = (float*) malloc(sizeof(float) * 0x100);
- UniChar ii = r * 0x100;
+ fl_fontsize->width[r] = (float*) malloc(sizeof(float) * 0x80);
+ UniChar ii = r * 0x80;
CGGlyph glyph;
CGSize advance_size;
- for (int j = 0; j < 0x100; j++) { // loop over the block
+ for (int j = 0; j < 0x80; j++) { // loop over the block
CTFontRef font2 = fl_fontsize->fontref;
bool must_release = false;
// ii spans all characters of this block
@@ -342,7 +342,7 @@ if (fl_mac_os_version >= 0x1050) {
}
}
// sum the widths of all characters of txt
- retval += fl_fontsize->width[r][uni & 0xFF];
+ retval += fl_fontsize->width[r][uni & 0x7F];
}
return retval;
} else {