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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include <unicode/normlzr.h> | 34 #include <unicode/normlzr.h> |
35 #include "SkPaint.h" | 35 #include "SkPaint.h" |
36 #include "SkTypeface.h" | 36 #include "SkTypeface.h" |
37 #include "SkTypes.h" | 37 #include "SkTypes.h" |
38 #include "core/platform/graphics/FloatRect.h" | 38 #include "core/platform/graphics/FloatRect.h" |
39 #include "core/platform/graphics/FontDescription.h" | 39 #include "core/platform/graphics/FontDescription.h" |
40 #include "core/platform/graphics/chromium/VDMXParser.h" | 40 #include "core/platform/graphics/chromium/VDMXParser.h" |
41 #include "wtf/unicode/Unicode.h" | 41 #include "wtf/unicode/Unicode.h" |
42 | 42 |
43 #if OS(WINDOWS) | 43 #if OS(WIN) |
44 #include "core/platform/win/HWndDC.h" | 44 #include "core/platform/win/HWndDC.h" |
45 #endif | 45 #endif |
46 | 46 |
47 namespace WebCore { | 47 namespace WebCore { |
48 | 48 |
49 // This is the largest VDMX table which we'll try to load and parse. | 49 // This is the largest VDMX table which we'll try to load and parse. |
50 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB | 50 static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB |
51 | 51 |
52 void SimpleFontData::platformInit() | 52 void SimpleFontData::platformInit() |
53 { | 53 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); | 125 static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G'); |
126 size_t vheaSize = face->getTableSize(vheaTag); | 126 size_t vheaSize = face->getTableSize(vheaTag); |
127 size_t vorgSize = face->getTableSize(vorgTag); | 127 size_t vorgSize = face->getTableSize(vorgTag); |
128 if ((vheaSize > 0) || (vorgSize > 0)) | 128 if ((vheaSize > 0) || (vorgSize > 0)) |
129 m_hasVerticalGlyphs = true; | 129 m_hasVerticalGlyphs = true; |
130 } | 130 } |
131 | 131 |
132 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is | 132 // In WebKit/WebCore/platform/graphics/SimpleFontData.cpp, m_spaceWidth is |
133 // calculated for us, but we need to calculate m_maxCharWidth and | 133 // calculated for us, but we need to calculate m_maxCharWidth and |
134 // m_avgCharWidth in order for text entry widgets to be sized correctly. | 134 // m_avgCharWidth in order for text entry widgets to be sized correctly. |
135 #if OS(WINDOWS) | 135 #if OS(WIN) |
136 m_maxCharWidth = SkScalarRound(metrics.fMaxCharWidth); | 136 m_maxCharWidth = SkScalarRound(metrics.fMaxCharWidth); |
137 #else | 137 #else |
138 // FIXME: This seems incorrect and should probably use fMaxCharWidth as | 138 // FIXME: This seems incorrect and should probably use fMaxCharWidth as |
139 // the code path above. | 139 // the code path above. |
140 SkScalar xRange = metrics.fXMax - metrics.fXMin; | 140 SkScalar xRange = metrics.fXMax - metrics.fXMin; |
141 m_maxCharWidth = SkScalarRound(xRange * SkScalarRound(m_platformData.size())
); | 141 m_maxCharWidth = SkScalarRound(xRange * SkScalarRound(m_platformData.size())
); |
142 #endif | 142 #endif |
143 | 143 |
144 if (metrics.fAvgCharWidth) | 144 if (metrics.fAvgCharWidth) |
145 m_avgCharWidth = SkScalarRound(metrics.fAvgCharWidth); | 145 m_avgCharWidth = SkScalarRound(metrics.fAvgCharWidth); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); | 275 paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); |
276 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { | 276 if (paint.textToGlyphs(&normalizedCharacters[0], normalizedLength * 2, 0)) { |
277 addResult.iterator->value = true; | 277 addResult.iterator->value = true; |
278 return true; | 278 return true; |
279 } | 279 } |
280 return false; | 280 return false; |
281 } | 281 } |
282 #endif | 282 #endif |
283 | 283 |
284 } // namespace WebCore | 284 } // namespace WebCore |
OLD | NEW |