Add support for TTC font files in SkFontHost_Freetype.

This is a companion change to a Chrome CL (
http://codereview.chromium.org/2870073/show )

(Patch by: jshin (Chromium))

BUG=http://crbug.com/50389
TEST=See the Chromium CL mentioned above.

http://codereview.appspot.com/1847046

git-svn-id: http://skia.googlecode.com/svn/trunk@593 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
agl@chromium.org 2010-08-06 18:08:18 +00:00
parent c9c9ebbc29
commit 61a678a28d

View File

@ -236,7 +236,10 @@ static SkFaceRec* ref_ft_face(uint32_t fontID) {
args.stream = &rec->fFTStream; args.stream = &rec->fFTStream;
} }
FT_Error err = FT_Open_Face(gFTLibrary, &args, 0, &rec->fFace); int face_index;
int length = SkFontHost::GetFileName(fontID, NULL, 0, &face_index);
FT_Error err = FT_Open_Face(gFTLibrary, &args, length ? face_index : 0,
&rec->fFace);
if (err) { // bad filename, try the default font if (err) { // bad filename, try the default font
fprintf(stderr, "ERROR: unable to open font '%x'\n", fontID); fprintf(stderr, "ERROR: unable to open font '%x'\n", fontID);