OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 m_maxCharWidth = 0; | 58 m_maxCharWidth = 0; |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 SkPaint paint; | 62 SkPaint paint; |
63 SkPaint::FontMetrics metrics; | 63 SkPaint::FontMetrics metrics; |
64 | 64 |
65 m_platformData.setupPaint(&paint); | 65 m_platformData.setupPaint(&paint); |
66 paint.getFontMetrics(&metrics); | 66 paint.getFontMetrics(&metrics); |
67 SkTypeface* face = paint.getTypeface(); | 67 SkTypeface* face = paint.getTypeface(); |
| 68 ASSERT(face); |
68 | 69 |
69 static const uint32_t vdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); | 70 static const uint32_t vdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); |
70 int pixelSize = m_platformData.size() + 0.5; | 71 int pixelSize = m_platformData.size() + 0.5; |
71 int vdmxAscent, vdmxDescent; | 72 int vdmxAscent, vdmxDescent; |
72 bool isVDMXValid = false; | 73 bool isVDMXValid = false; |
73 | 74 |
74 size_t vdmxSize = face->getTableSize(vdmxTag); | 75 size_t vdmxSize = face->getTableSize(vdmxTag); |
75 if (vdmxSize && vdmxSize < maxVDMXTableSize) { | 76 if (vdmxSize && vdmxSize < maxVDMXTableSize) { |
76 uint8_t* vdmxTable = (uint8_t*) fastMalloc(vdmxSize); | 77 uint8_t* vdmxTable = (uint8_t*) fastMalloc(vdmxSize); |
77 if (vdmxTable | 78 if (vdmxTable |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 284 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
284 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 285 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { |
285 addResult.iterator->value = true; | 286 addResult.iterator->value = true; |
286 return true; | 287 return true; |
287 } | 288 } |
288 return false; | 289 return false; |
289 } | 290 } |
290 #endif | 291 #endif |
291 | 292 |
292 } // namespace WebCore | 293 } // namespace WebCore |
OLD | NEW |