OSDN Git Service
(root)
/
hengbandforosx
/
hengbandosx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4f2f128
)
In drawWChar(), allow for the unlikely possibility that the character to be rendered...
author
Eric Branlund
<ebranlund@fastmail.com>
Sun, 22 Nov 2020 01:01:19 +0000
(17:01 -0800)
committer
Eric Branlund
<ebranlund@fastmail.com>
Sun, 22 Nov 2020 01:01:19 +0000
(17:01 -0800)
src/main-cocoa.m
patch
|
blob
|
history
diff --git
a/src/main-cocoa.m
b/src/main-cocoa.m
index
7afde22
..
d8ede50
100644
(file)
--- a/
src/main-cocoa.m
+++ b/
src/main-cocoa.m
@@
-2445,13
+2445,21
@@
static int compare_advances(const void *ap, const void *bp)
{
CGFloat tileOffsetY = self.fontAscender;
CGFloat tileOffsetX = 0.0;
{
CGFloat tileOffsetY = self.fontAscender;
CGFloat tileOffsetX = 0.0;
- UniChar unicharString[2] = {(UniChar)wchar, 0};
+ UniChar unicharString[2];
+ int nuni;
+
+ if (CFStringGetSurrogatePairForLongCharacter(wchar, unicharString)) {
+ nuni = 2;
+ } else {
+ unicharString[0] = (UniChar) wchar;
+ nuni = 1;
+ }
/* Get glyph and advance */
/* Get glyph and advance */
- CGGlyph thisGlyphArray[
1] = {
0 };
- CGSize advances[
1] = {
{ 0, 0 } };
+ CGGlyph thisGlyphArray[
2] = { 0,
0 };
+ CGSize advances[
2] = { { 0, 0 },
{ 0, 0 } };
CTFontGetGlyphsForCharacters(
CTFontGetGlyphsForCharacters(
- (CTFontRef)font, unicharString, thisGlyphArray,
1
);
+ (CTFontRef)font, unicharString, thisGlyphArray,
nuni
);
CGGlyph glyph = thisGlyphArray[0];
CTFontGetAdvancesForGlyphs(
(CTFontRef)font, kCTFontHorizontalOrientation, thisGlyphArray,
CGGlyph glyph = thisGlyphArray[0];
CTFontGetAdvancesForGlyphs(
(CTFontRef)font, kCTFontHorizontalOrientation, thisGlyphArray,