Fix non-bmp in generateCharToGlyph on Mac.
git-svn-id: http://skia.googlecode.com/svn/trunk@11957 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
172c363a68
commit
fb1663a0a5
@ -90,6 +90,7 @@ protected:
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setTextSize(SkIntToScalar(TEXT_SIZE));
|
||||
paint.setTextSkewX(-SK_Scalar1 / 4);
|
||||
//paint.setTypeface(fFace);
|
||||
//paint.setFakeBoldText(true);
|
||||
|
||||
|
@ -99,7 +99,10 @@ protected:
|
||||
virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) = 0;
|
||||
virtual SkTypeface* onCreateFromStream(SkStream*, int ttcIndex) = 0;
|
||||
virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) = 0;
|
||||
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) = 0;
|
||||
|
||||
// TODO: make this pure-virtual once all ports know about it
|
||||
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
|
||||
unsigned styleBits) = 0;
|
||||
private:
|
||||
static SkFontMgr* Factory(); // implemented by porting layer
|
||||
|
||||
|
@ -945,21 +945,21 @@ unsigned SkScalerContext_Mac::generateGlyphCount(void) {
|
||||
}
|
||||
|
||||
uint16_t SkScalerContext_Mac::generateCharToGlyph(SkUnichar uni) {
|
||||
CGGlyph cgGlyph;
|
||||
UniChar theChar;
|
||||
|
||||
// Validate our parameters and state
|
||||
SkASSERT(uni <= 0x0000FFFF);
|
||||
SkASSERT(sizeof(CGGlyph) <= sizeof(uint16_t));
|
||||
CGGlyph cgGlyph[2];
|
||||
UniChar theChar[2];
|
||||
|
||||
// Get the glyph
|
||||
theChar = (UniChar) uni;
|
||||
size_t numUniChar = SkUTF16_FromUnichar(uni, theChar);
|
||||
SkASSERT(sizeof(CGGlyph) <= sizeof(uint16_t));
|
||||
|
||||
if (!CTFontGetGlyphsForCharacters(fCTFont, &theChar, &cgGlyph, 1)) {
|
||||
cgGlyph = 0;
|
||||
// Undocumented behavior of CTFontGetGlyphsForCharacters with non-bmp code points.
|
||||
// When a surragate pair is detected, the glyph index used is the index of the first
|
||||
// UniChar of the pair (the lower location).
|
||||
if (!CTFontGetGlyphsForCharacters(fCTFont, theChar, cgGlyph, numUniChar)) {
|
||||
cgGlyph[0] = 0;
|
||||
}
|
||||
|
||||
return cgGlyph;
|
||||
return cgGlyph[0];
|
||||
}
|
||||
|
||||
void SkScalerContext_Mac::generateAdvance(SkGlyph* glyph) {
|
||||
|
Loading…
Reference in New Issue
Block a user