| 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 19 matching lines...) Expand all Loading... |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "platform/fonts/SimpleFontData.h" | 31 #include "platform/fonts/SimpleFontData.h" |
| 32 | 32 |
| 33 #include "SkPaint.h" | 33 #include "SkPaint.h" |
| 34 #include "SkPath.h" | 34 #include "SkPath.h" |
| 35 #include "SkTypeface.h" | 35 #include "SkTypeface.h" |
| 36 #include "SkTypes.h" | 36 #include "SkTypes.h" |
| 37 #include "SkUtils.h" | 37 #include "SkUtils.h" |
| 38 #include "platform/fonts/FontDescription.h" | 38 #include "platform/fonts/FontDescription.h" |
| 39 #include "platform/fonts/GlyphPage.h" | 39 #include "platform/fonts/GlyphPage.h" |
| 40 #include "platform/fonts/OpenType/OpenTypeOS2Table.h" |
| 40 #include "platform/fonts/VDMXParser.h" | 41 #include "platform/fonts/VDMXParser.h" |
| 41 #include "platform/geometry/FloatRect.h" | 42 #include "platform/geometry/FloatRect.h" |
| 42 #include "wtf/MathExtras.h" | 43 #include "wtf/MathExtras.h" |
| 43 #include "wtf/Partitions.h" | 44 #include "wtf/Partitions.h" |
| 44 #include "wtf/text/CharacterNames.h" | 45 #include "wtf/text/CharacterNames.h" |
| 45 #include "wtf/text/Unicode.h" | 46 #include "wtf/text/Unicode.h" |
| 46 #include <unicode/normlzr.h> | 47 #include <unicode/normlzr.h> |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 94 } |
| 94 | 95 |
| 95 SkPaint paint; | 96 SkPaint paint; |
| 96 SkPaint::FontMetrics metrics; | 97 SkPaint::FontMetrics metrics; |
| 97 | 98 |
| 98 m_platformData.setupPaint(&paint); | 99 m_platformData.setupPaint(&paint); |
| 99 paint.getFontMetrics(&metrics); | 100 paint.getFontMetrics(&metrics); |
| 100 SkTypeface* face = paint.getTypeface(); | 101 SkTypeface* face = paint.getTypeface(); |
| 101 ASSERT(face); | 102 ASSERT(face); |
| 102 | 103 |
| 104 int16_t ascentInUnits, descentInUnits; |
| 105 getAscentDescentFromOS2Table(face, ascentInUnits, descentInUnits); |
| 106 |
| 103 int vdmxAscent = 0, vdmxDescent = 0; | 107 int vdmxAscent = 0, vdmxDescent = 0; |
| 104 bool isVDMXValid = false; | 108 bool isVDMXValid = false; |
| 105 | 109 |
| 106 #if OS(LINUX) || OS(ANDROID) | 110 #if OS(LINUX) || OS(ANDROID) |
| 107 // Manually digging up VDMX metrics is only applicable when bytecode hinting
using FreeType. | 111 // Manually digging up VDMX metrics is only applicable when bytecode hinting
using FreeType. |
| 108 // With GDI, the metrics will already have taken this into account (as neede
d). | 112 // With GDI, the metrics will already have taken this into account (as neede
d). |
| 109 // With DirectWrite or CoreText, no bytecode hinting is ever done. | 113 // With DirectWrite or CoreText, no bytecode hinting is ever done. |
| 110 // This code should be pushed into FreeType (hinted font metrics). | 114 // This code should be pushed into FreeType (hinted font metrics). |
| 111 static const uint32_t vdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); | 115 static const uint32_t vdmxTag = SkSetFourByteTag('V', 'D', 'M', 'X'); |
| 112 int pixelSize = m_platformData.size() + 0.5; | 116 int pixelSize = m_platformData.size() + 0.5; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 if (glyphs[i]) { | 479 if (glyphs[i]) { |
| 476 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 480 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
| 477 haveGlyphs = true; | 481 haveGlyphs = true; |
| 478 } | 482 } |
| 479 } | 483 } |
| 480 | 484 |
| 481 return haveGlyphs; | 485 return haveGlyphs; |
| 482 } | 486 } |
| 483 | 487 |
| 484 } // namespace blink | 488 } // namespace blink |
| OLD | NEW |