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

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

Issue 12807004: move impl of AdvancedTypefaceMetrics into typeface (3) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 glyphIndex != 0; 440 glyphIndex != 0;
441 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex)) { 441 charCode = FT_Get_Next_Char(face, charCode, &glyphIndex)) {
442 if (charCode && 442 if (charCode &&
443 ((*glyphToUnicode)[glyphIndex] == 0 || preferredMap)) { 443 ((*glyphToUnicode)[glyphIndex] == 0 || preferredMap)) {
444 (*glyphToUnicode)[glyphIndex] = charCode; 444 (*glyphToUnicode)[glyphIndex] = charCode;
445 } 445 }
446 } 446 }
447 } 447 }
448 } 448 }
449 449
450 // static 450 SkAdvancedTypefaceMetrics* SkTypeface_FreeType::onGetAdvancedTypefaceMetrics(
451 SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
452 uint32_t fontID,
453 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo, 451 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo,
454 const uint32_t* glyphIDs, 452 const uint32_t* glyphIDs,
455 uint32_t glyphIDsCount) { 453 uint32_t glyphIDsCount) const {
456 #if defined(SK_BUILD_FOR_MAC) 454 #if defined(SK_BUILD_FOR_MAC)
457 return NULL; 455 return NULL;
458 #else 456 #else
459 SkAutoMutexAcquire ac(gFTMutex); 457 SkAutoMutexAcquire ac(gFTMutex);
460 FT_Library libInit = NULL; 458 FT_Library libInit = NULL;
461 if (gFTCount == 0) { 459 if (gFTCount == 0) {
462 if (!InitFreetype()) 460 if (!InitFreetype())
463 sk_throw(); 461 sk_throw();
464 libInit = gFTLibrary; 462 libInit = gFTLibrary;
465 } 463 }
466 SkAutoTCallIProc<struct FT_LibraryRec_, FT_Done_FreeType> ftLib(libInit); 464 SkAutoTCallIProc<struct FT_LibraryRec_, FT_Done_FreeType> ftLib(libInit);
467 SkFaceRec* rec = ref_ft_face(fontID); 465 SkFaceRec* rec = ref_ft_face(this->uniqueID());
468 if (NULL == rec) 466 if (NULL == rec)
469 return NULL; 467 return NULL;
470 FT_Face face = rec->fFace; 468 FT_Face face = rec->fFace;
471 469
472 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; 470 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
473 info->fFontName.set(FT_Get_Postscript_Name(face)); 471 info->fFontName.set(FT_Get_Postscript_Name(face));
474 info->fMultiMaster = FT_HAS_MULTIPLE_MASTERS(face); 472 info->fMultiMaster = FT_HAS_MULTIPLE_MASTERS(face);
475 info->fLastGlyphID = face->num_glyphs - 1; 473 info->fLastGlyphID = face->num_glyphs - 1;
476 info->fEmSize = 1000; 474 info->fEmSize = 1000;
477 475
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 *style = (SkTypeface::Style) tempStyle; 1363 *style = (SkTypeface::Style) tempStyle;
1366 } 1364 }
1367 if (isFixedWidth) { 1365 if (isFixedWidth) {
1368 *isFixedWidth = FT_IS_FIXED_WIDTH(face); 1366 *isFixedWidth = FT_IS_FIXED_WIDTH(face);
1369 } 1367 }
1370 1368
1371 FT_Done_Face(face); 1369 FT_Done_Face(face);
1372 FT_Done_FreeType(library); 1370 FT_Done_FreeType(library);
1373 return true; 1371 return true;
1374 } 1372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698