OLD | NEW |
1 /* libs/graphics/ports/SkFontHost_fontconfig.cpp | 1 /* libs/graphics/ports/SkFontHost_fontconfig.cpp |
2 ** | 2 ** |
3 ** Copyright 2008, Google Inc. | 3 ** Copyright 2008, Google Inc. |
4 ** | 4 ** |
5 ** Licensed under the Apache License, Version 2.0 (the "License"); | 5 ** Licensed under the Apache License, Version 2.0 (the "License"); |
6 ** you may not use this file except in compliance with the License. | 6 ** you may not use this file except in compliance with the License. |
7 ** You may obtain a copy of the License at | 7 ** You may obtain a copy of the License at |
8 ** | 8 ** |
9 ** http://www.apache.org/licenses/LICENSE-2.0 | 9 ** http://www.apache.org/licenses/LICENSE-2.0 |
10 ** | 10 ** |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 SkASSERT(!"SkFontHost::Deserialize unimplemented"); | 271 SkASSERT(!"SkFontHost::Deserialize unimplemented"); |
272 return NULL; | 272 return NULL; |
273 } | 273 } |
274 | 274 |
275 void SkFontHost::Serialize(const SkTypeface*, SkWStream*) { | 275 void SkFontHost::Serialize(const SkTypeface*, SkWStream*) { |
276 SkASSERT(!"SkFontHost::Serialize unimplemented"); | 276 SkASSERT(!"SkFontHost::Serialize unimplemented"); |
277 } | 277 } |
278 | 278 |
279 SkScalerContext* SkFontHost::CreateFallbackScalerContext | 279 SkScalerContext* SkFontHost::CreateFallbackScalerContext |
280 (const SkScalerContext::Rec& rec) { | 280 (const SkScalerContext::Rec& rec) { |
281 FcPattern* pattern = FcPatternCreate(); | 281 FcPattern* match = FontMatch(FC_FAMILY, FcTypeString, "serif", |
282 FcConfigSubstitute(0, pattern, FcMatchPattern); | 282 NULL); |
283 FcDefaultSubstitute(pattern); | |
284 | |
285 FcResult result; | |
286 FcPattern* match = FcFontMatch(0, pattern, &result); | |
287 FcPatternDestroy(pattern); | |
288 | 283 |
289 // This will fail when we have no fonts on the system. | 284 // This will fail when we have no fonts on the system. |
290 SkASSERT(match); | 285 SkASSERT(match); |
291 | 286 |
292 FcChar8* filename; | 287 FcChar8* filename; |
293 if (FcPatternGetString(match, FC_FILE, 0, &filename) != FcResultMatch) { | 288 if (FcPatternGetString(match, FC_FILE, 0, &filename) != FcResultMatch) { |
294 FcPatternDestroy(match); | 289 FcPatternDestroy(match); |
295 return NULL; | 290 return NULL; |
296 } | 291 } |
297 // Now @filename is pointing into @match | 292 // Now @filename is pointing into @match |
(...skipping 16 matching lines...) Expand all Loading... |
314 | 309 |
315 /////////////////////////////////////////////////////////////////////////////// | 310 /////////////////////////////////////////////////////////////////////////////// |
316 | 311 |
317 size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar) | 312 size_t SkFontHost::ShouldPurgeFontCache(size_t sizeAllocatedSoFar) |
318 { | 313 { |
319 if (sizeAllocatedSoFar > kFontCacheMemoryBudget) | 314 if (sizeAllocatedSoFar > kFontCacheMemoryBudget) |
320 return sizeAllocatedSoFar - kFontCacheMemoryBudget; | 315 return sizeAllocatedSoFar - kFontCacheMemoryBudget; |
321 else | 316 else |
322 return 0; // nothing to do | 317 return 0; // nothing to do |
323 } | 318 } |
OLD | NEW |