| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 m_customFontData(std::move(customData)) { | 68 m_customFontData(std::move(customData)) { |
| 69 platformInit(subpixelAscentDescent); | 69 platformInit(subpixelAscentDescent); |
| 70 platformGlyphInit(); | 70 platformGlyphInit(); |
| 71 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) { | 71 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) { |
| 72 m_verticalData = platformData.verticalData(); | 72 m_verticalData = platformData.verticalData(); |
| 73 m_hasVerticalGlyphs = | 73 m_hasVerticalGlyphs = |
| 74 m_verticalData.get() && m_verticalData->hasVerticalMetrics(); | 74 m_verticalData.get() && m_verticalData->hasVerticalMetrics(); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, | 78 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, |
| 79 float fontSize, | 79 PassRefPtr<OpenTypeVerticalData> verticalData) |
| 80 bool syntheticBold, | 80 : m_platformData(platformData), |
| 81 bool syntheticItalic) | |
| 82 : m_platformData( | |
| 83 FontPlatformData(fontSize, syntheticBold, syntheticItalic)), | |
| 84 m_isTextOrientationFallback(false), | 81 m_isTextOrientationFallback(false), |
| 85 m_verticalData(nullptr), | 82 m_verticalData(verticalData), |
| 86 m_hasVerticalGlyphs(false), | 83 m_hasVerticalGlyphs(false) {} |
| 87 m_customFontData(std::move(customData)) {} | |
| 88 | 84 |
| 89 void SimpleFontData::platformInit(bool subpixelAscentDescent) { | 85 void SimpleFontData::platformInit(bool subpixelAscentDescent) { |
| 90 if (!m_platformData.size()) { | 86 if (!m_platformData.size()) { |
| 91 m_fontMetrics.reset(); | 87 m_fontMetrics.reset(); |
| 92 m_avgCharWidth = 0; | 88 m_avgCharWidth = 0; |
| 93 m_maxCharWidth = 0; | 89 m_maxCharWidth = 0; |
| 94 return; | 90 return; |
| 95 } | 91 } |
| 96 | 92 |
| 97 SkPaint::FontMetrics metrics; | 93 SkPaint::FontMetrics metrics; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { | 381 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { |
| 386 if (!m_platformData.size()) | 382 if (!m_platformData.size()) |
| 387 return 0; | 383 return 0; |
| 388 | 384 |
| 389 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated."); | 385 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated."); |
| 390 | 386 |
| 391 return SkiaTextMetrics(&m_paint).getSkiaWidthForGlyph(glyph); | 387 return SkiaTextMetrics(&m_paint).getSkiaWidthForGlyph(glyph); |
| 392 } | 388 } |
| 393 | 389 |
| 394 } // namespace blink | 390 } // namespace blink |
| OLD | NEW |