Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: src/ports/SkFontHost_mac.cpp

Issue 596413002: Correct glyph with non-bmp from typeface on Mac. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/FontHostTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include <vector> 9 #include <vector>
10 #ifdef SK_BUILD_FOR_MAC 10 #ifdef SK_BUILD_FOR_MAC
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 // If 'glyphs' is NULL, then compact glyphStorage in-place. 1974 // If 'glyphs' is NULL, then compact glyphStorage in-place.
1975 // If all are bmp and 'glyphs' is non-NULL, 'glyphs' already contains the co mpact glyphs. 1975 // If all are bmp and 'glyphs' is non-NULL, 'glyphs' already contains the co mpact glyphs.
1976 // If some are non-bmp and 'glyphs' is non-NULL, copy and compact into 'glyp hs'. 1976 // If some are non-bmp and 'glyphs' is non-NULL, copy and compact into 'glyp hs'.
1977 uint16_t* compactedGlyphs = glyphs; 1977 uint16_t* compactedGlyphs = glyphs;
1978 if (NULL == compactedGlyphs) { 1978 if (NULL == compactedGlyphs) {
1979 compactedGlyphs = macGlyphs; 1979 compactedGlyphs = macGlyphs;
1980 } 1980 }
1981 if (srcCount > glyphCount) { 1981 if (srcCount > glyphCount) {
1982 int extra = 0; 1982 int extra = 0;
1983 for (int i = 0; i < glyphCount; ++i) { 1983 for (int i = 0; i < glyphCount; ++i) {
1984 compactedGlyphs[i] = macGlyphs[i + extra];
1984 if (SkUTF16_IsHighSurrogate(src[i + extra])) { 1985 if (SkUTF16_IsHighSurrogate(src[i + extra])) {
1985 ++extra; 1986 ++extra;
1986 } 1987 }
1987 compactedGlyphs[i] = macGlyphs[i + extra];
1988 } 1988 }
1989 } 1989 }
1990 1990
1991 if (allEncoded) { 1991 if (allEncoded) {
1992 return glyphCount; 1992 return glyphCount;
1993 } 1993 }
1994 1994
1995 // If we got false, then we need to manually look for first failure. 1995 // If we got false, then we need to manually look for first failure.
1996 for (int i = 0; i < glyphCount; ++i) { 1996 for (int i = 0; i < glyphCount; ++i) {
1997 if (0 == compactedGlyphs[i]) { 1997 if (0 == compactedGlyphs[i]) {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits); 2309 return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits);
2310 } 2310 }
2311 }; 2311 };
2312 2312
2313 /////////////////////////////////////////////////////////////////////////////// 2313 ///////////////////////////////////////////////////////////////////////////////
2314 2314
2315 SkFontMgr* SkFontMgr::Factory() { 2315 SkFontMgr* SkFontMgr::Factory() {
2316 return SkNEW(SkFontMgr_Mac); 2316 return SkNEW(SkFontMgr_Mac);
2317 } 2317 }
2318 #endif 2318 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/FontHostTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698