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

Side by Side Diff: webkit/api/src/gtk/WebFontInfo.cpp

Issue 149437: Linux: don't crash when performing font fallback to a non-scalable font. (Closed)
Patch Set: Created 11 years, 5 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 | « skia/ext/SkFontHost_fontconfig_direct.cpp ('k') | no next file » | 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 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } else 51 } else
52 FcCharSetAddChar(cset, characters[i]); 52 FcCharSetAddChar(cset, characters[i]);
53 } 53 }
54 FcPattern* pattern = FcPatternCreate(); 54 FcPattern* pattern = FcPatternCreate();
55 55
56 FcValue fcvalue; 56 FcValue fcvalue;
57 fcvalue.type = FcTypeCharSet; 57 fcvalue.type = FcTypeCharSet;
58 fcvalue.u.c = cset; 58 fcvalue.u.c = cset;
59 FcPatternAdd(pattern, FC_CHARSET, fcvalue, 0); 59 FcPatternAdd(pattern, FC_CHARSET, fcvalue, 0);
60 60
61 fcvalue.type = FcTypeBool;
62 fcvalue.u.b = FcTrue;
63 FcPatternAdd(pattern, FC_SCALABLE, fcvalue, 0);
64
61 FcConfigSubstitute(0, pattern, FcMatchPattern); 65 FcConfigSubstitute(0, pattern, FcMatchPattern);
62 FcDefaultSubstitute(pattern); 66 FcDefaultSubstitute(pattern);
63 67
64 FcResult result; 68 FcResult result;
65 FcPattern* match = FcFontMatch(0, pattern, &result); 69 FcPattern* match = FcFontMatch(0, pattern, &result);
66 FcPatternDestroy(pattern); 70 FcPatternDestroy(pattern);
67 FcCharSetDestroy(cset); 71 FcCharSetDestroy(cset);
68 72
69 if (match) { 73 if (match) {
70 FcChar8* family; 74 FcChar8* family;
71 WebString result; 75 WebString result;
72 if (FcPatternGetString(match, FC_FAMILY, 0, &family) == FcResultMatch) { 76 if (FcPatternGetString(match, FC_FAMILY, 0, &family) == FcResultMatch) {
73 const char* charFamily = reinterpret_cast<char*>(family); 77 const char* charFamily = reinterpret_cast<char*>(family);
74 result = WebString::fromUTF8(charFamily, strlen(charFamily)); 78 result = WebString::fromUTF8(charFamily, strlen(charFamily));
75 } 79 }
76 FcPatternDestroy(match); 80 FcPatternDestroy(match);
77 return result; 81 return result;
78 } 82 }
79 83
80 return WebString(); 84 return WebString();
81 } 85 }
82 86
83 } // namespace WebKit 87 } // namespace WebKit
OLDNEW
« no previous file with comments | « skia/ext/SkFontHost_fontconfig_direct.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698