| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
ntDescription& fontDescription, float scaleFactor) const | 374 PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo
ntDescription& fontDescription, float scaleFactor) const |
| 375 { | 375 { |
| 376 const float scaledSize = lroundf(fontDescription.computedSize() * scaleFacto
r); | 376 const float scaledSize = lroundf(fontDescription.computedSize() * scaleFacto
r); |
| 377 return SimpleFontData::create(FontPlatformData(m_platformData, scaledSize),
isCustomFont() ? CustomFontData::create() : nullptr); | 377 return SimpleFontData::create(FontPlatformData(m_platformData, scaledSize),
isCustomFont() ? CustomFontData::create() : nullptr); |
| 378 } | 378 } |
| 379 | 379 |
| 380 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo
unds) | 380 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo
unds) |
| 381 { | 381 { |
| 382 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 382 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 383 | 383 |
| 384 SkPath path; | 384 paint.measureText(&glyph, sizeof(glyph), &bounds); |
| 385 paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path); | 385 bounds = SkRect::MakeLTRB(bounds.left() - 5, bounds.top() - 5, bounds.right(
) + 10, bounds.bottom() + 10); |
| 386 bounds = path.getBounds(); | |
| 387 | |
| 388 if (!paint.isSubpixelText()) { | 386 if (!paint.isSubpixelText()) { |
| 389 SkIRect ir; | 387 SkIRect ir; |
| 390 bounds.round(&ir); | 388 bounds.round(&ir); |
| 391 bounds.set(ir); | 389 bounds.set(ir); |
| 392 } | 390 } |
| 393 } | 391 } |
| 394 | 392 |
| 395 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const | 393 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const |
| 396 { | 394 { |
| 397 if (!m_platformData.size()) | 395 if (!m_platformData.size()) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 if (glyphs[i]) { | 445 if (glyphs[i]) { |
| 448 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 446 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
| 449 haveGlyphs = true; | 447 haveGlyphs = true; |
| 450 } | 448 } |
| 451 } | 449 } |
| 452 | 450 |
| 453 return haveGlyphs; | 451 return haveGlyphs; |
| 454 } | 452 } |
| 455 | 453 |
| 456 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |