| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 max_char_width_ = 0; | 89 max_char_width_ = 0; |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 | 92 |
| 93 SkPaint::FontMetrics metrics; | 93 SkPaint::FontMetrics metrics; |
| 94 | 94 |
| 95 platform_data_.SetupPaint(&paint_); | 95 platform_data_.SetupPaint(&paint_); |
| 96 paint_.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 96 paint_.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 97 paint_.getFontMetrics(&metrics); | 97 paint_.getFontMetrics(&metrics); |
| 98 SkTypeface* face = paint_.getTypeface(); | 98 SkTypeface* face = paint_.getTypeface(); |
| 99 ASSERT(face); | 99 DCHECK(face); |
| 100 | 100 |
| 101 int vdmx_ascent = 0, vdmx_descent = 0; | 101 int vdmx_ascent = 0, vdmx_descent = 0; |
| 102 bool is_vdmx_valid = false; | 102 bool is_vdmx_valid = false; |
| 103 | 103 |
| 104 #if OS(LINUX) || OS(ANDROID) | 104 #if OS(LINUX) || OS(ANDROID) |
| 105 // Manually digging up VDMX metrics is only applicable when bytecode hinting | 105 // Manually digging up VDMX metrics is only applicable when bytecode hinting |
| 106 // using FreeType. With DirectWrite or CoreText, no bytecode hinting is ever | 106 // using FreeType. With DirectWrite or CoreText, no bytecode hinting is ever |
| 107 // done. This code should be pushed into FreeType (hinted font metrics). | 107 // done. This code should be pushed into FreeType (hinted font metrics). |
| 108 static const uint32_t kVdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); | 108 static const uint32_t kVdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); |
| 109 int pixel_size = platform_data_.size() + 0.5; | 109 int pixel_size = platform_data_.size() + 0.5; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 missing_glyph_data_.glyph = 0; | 283 missing_glyph_data_.glyph = 0; |
| 284 } | 284 } |
| 285 | 285 |
| 286 const SimpleFontData* SimpleFontData::FontDataForCharacter(UChar32) const { | 286 const SimpleFontData* SimpleFontData::FontDataForCharacter(UChar32) const { |
| 287 return this; | 287 return this; |
| 288 } | 288 } |
| 289 | 289 |
| 290 Glyph SimpleFontData::GlyphForCharacter(UChar32 codepoint) const { | 290 Glyph SimpleFontData::GlyphForCharacter(UChar32 codepoint) const { |
| 291 uint16_t glyph; | 291 uint16_t glyph; |
| 292 SkTypeface* typeface = PlatformData().Typeface(); | 292 SkTypeface* typeface = PlatformData().Typeface(); |
| 293 RELEASE_ASSERT(typeface); | 293 CHECK(typeface); |
| 294 typeface->charsToGlyphs(&codepoint, SkTypeface::kUTF32_Encoding, &glyph, 1); | 294 typeface->charsToGlyphs(&codepoint, SkTypeface::kUTF32_Encoding, &glyph, 1); |
| 295 return glyph; | 295 return glyph; |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool SimpleFontData::IsSegmented() const { | 298 bool SimpleFontData::IsSegmented() const { |
| 299 return false; | 299 return false; |
| 300 } | 300 } |
| 301 | 301 |
| 302 PassRefPtr<SimpleFontData> SimpleFontData::VerticalRightOrientationFontData() | 302 PassRefPtr<SimpleFontData> SimpleFontData::VerticalRightOrientationFontData() |
| 303 const { | 303 const { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 float SimpleFontData::PlatformWidthForGlyph(Glyph glyph) const { | 382 float SimpleFontData::PlatformWidthForGlyph(Glyph glyph) const { |
| 383 if (!platform_data_.size()) | 383 if (!platform_data_.size()) |
| 384 return 0; | 384 return 0; |
| 385 | 385 |
| 386 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated."); | 386 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated."); |
| 387 | 387 |
| 388 return SkiaTextMetrics(&paint_).GetSkiaWidthForGlyph(glyph); | 388 return SkiaTextMetrics(&paint_).GetSkiaWidthForGlyph(glyph); |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace blink | 391 } // namespace blink |
| OLD | NEW |