OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |