OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | |
6 * | 7 * |
7 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
11 * | 12 * |
12 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 16 * Library General Public License for more details. |
16 * | 17 * |
17 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
21 * | 22 * |
22 */ | 23 */ |
23 | 24 |
24 #include "config.h" | 25 #include "config.h" |
25 #include "platform/fonts/Font.h" | 26 #include "platform/fonts/Font.h" |
26 | 27 |
28 #include "SkPaint.h" | |
29 #include "SkTemplates.h" | |
27 #include "platform/LayoutUnit.h" | 30 #include "platform/LayoutUnit.h" |
28 #include "platform/RuntimeEnabledFeatures.h" | 31 #include "platform/RuntimeEnabledFeatures.h" |
29 #include "platform/fonts/Character.h" | 32 #include "platform/fonts/Character.h" |
30 #include "platform/fonts/FontCache.h" | 33 #include "platform/fonts/FontCache.h" |
31 #include "platform/fonts/FontFallbackList.h" | 34 #include "platform/fonts/FontFallbackList.h" |
32 #include "platform/fonts/FontPlatformFeatures.h" | 35 #include "platform/fonts/FontPlatformFeatures.h" |
33 #include "platform/fonts/GlyphBuffer.h" | 36 #include "platform/fonts/GlyphBuffer.h" |
34 #include "platform/fonts/GlyphPageTreeNode.h" | 37 #include "platform/fonts/GlyphPageTreeNode.h" |
35 #include "platform/fonts/SimpleFontData.h" | 38 #include "platform/fonts/SimpleFontData.h" |
36 #include "platform/fonts/SimpleShaper.h" | 39 #include "platform/fonts/SimpleShaper.h" |
40 #include "platform/fonts/harfbuzz/HarfBuzzShaper.h" | |
37 #include "platform/geometry/FloatRect.h" | 41 #include "platform/geometry/FloatRect.h" |
38 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
39 #include "platform/text/TextRun.h" | 43 #include "platform/text/TextRun.h" |
40 #include "wtf/MainThread.h" | 44 #include "wtf/MainThread.h" |
41 #include "wtf/StdLibExtras.h" | 45 #include "wtf/StdLibExtras.h" |
42 #include "wtf/unicode/CharacterNames.h" | 46 #include "wtf/unicode/CharacterNames.h" |
43 #include "wtf/unicode/Unicode.h" | 47 #include "wtf/unicode/Unicode.h" |
44 | 48 |
45 using namespace WTF; | 49 using namespace WTF; |
46 using namespace Unicode; | 50 using namespace Unicode; |
47 | 51 |
48 namespace blink { | 52 namespace blink { |
49 | 53 |
54 bool FontPlatformFeatures::canExpandAroundIdeographsInComplexText() | |
55 { | |
56 return false; | |
57 } | |
58 | |
50 CodePath Font::s_codePath = AutoPath; | 59 CodePath Font::s_codePath = AutoPath; |
51 | 60 |
52 // ============================================================================= =============== | |
53 // Font Implementation (Cross-Platform Portion) | |
54 // ============================================================================= =============== | |
55 | |
56 Font::Font() | 61 Font::Font() |
57 { | 62 { |
58 } | 63 } |
59 | 64 |
60 Font::Font(const FontDescription& fd) | 65 Font::Font(const FontDescription& fd) |
61 : m_fontDescription(fd) | 66 : m_fontDescription(fd) |
62 { | 67 { |
63 } | 68 } |
64 | 69 |
65 Font::Font(const Font& other) | 70 Font::Font(const Font& other) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 if (glyphBuffer.isEmpty()) | 236 if (glyphBuffer.isEmpty()) |
232 return nullptr; | 237 return nullptr; |
233 | 238 |
234 FloatRect blobBounds = runInfo.bounds; | 239 FloatRect blobBounds = runInfo.bounds; |
235 blobBounds.moveBy(-textOrigin); | 240 blobBounds.moveBy(-textOrigin); |
236 | 241 |
237 float ignoredWidth; | 242 float ignoredWidth; |
238 return buildTextBlob(glyphBuffer, initialAdvance, blobBounds, ignoredWidth, couldUseLCDRenderedText); | 243 return buildTextBlob(glyphBuffer, initialAdvance, blobBounds, ignoredWidth, couldUseLCDRenderedText); |
239 } | 244 } |
240 | 245 |
246 PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initia lAdvance, | |
247 const FloatRect& bounds, float& advance, bool couldUseLCD) const | |
248 { | |
249 ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); | |
250 | |
251 // FIXME: Implement the more general full-positioning path. | |
252 ASSERT(!glyphBuffer.hasOffsets()); | |
253 | |
254 SkTextBlobBuilder builder; | |
255 SkScalar x = SkFloatToScalar(initialAdvance); | |
256 SkRect skBounds = bounds; | |
257 | |
258 unsigned i = 0; | |
259 while (i < glyphBuffer.size()) { | |
260 const SimpleFontData* fontData = glyphBuffer.fontDataAt(i); | |
261 | |
262 // FIXME: Handle vertical text. | |
263 if (fontData->platformData().orientation() == Vertical) | |
264 return nullptr; | |
265 | |
266 // FIXME: Handle SVG fonts. | |
267 if (fontData->isSVGFont()) | |
268 return nullptr; | |
269 | |
270 // FIXME: FontPlatformData makes some decisions on the device scale | |
271 // factor, which is found via the GraphicsContext. This should be fixed | |
272 // to avoid correctness problems here. | |
273 SkPaint paint; | |
274 fontData->platformData().setupPaint(&paint); | |
275 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | |
276 | |
277 // FIXME: this should go away after the big LCD cleanup. | |
278 paint.setLCDRenderText(paint.isLCDRenderText() && couldUseLCD); | |
279 | |
280 unsigned start = i++; | |
281 while (i < glyphBuffer.size() && glyphBuffer.fontDataAt(i) == fontData) | |
282 i++; | |
283 unsigned count = i - start; | |
284 | |
285 const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPosH(paint, count, 0, &skBounds); | |
286 | |
287 const uint16_t* glyphs = glyphBuffer.glyphs(start); | |
288 std::copy(glyphs, glyphs + count, buffer.glyphs); | |
289 | |
290 const float* advances = glyphBuffer.advances(start); | |
291 for (unsigned j = 0; j < count; j++) { | |
292 buffer.pos[j] = x; | |
293 x += SkFloatToScalar(advances[j]); | |
294 } | |
295 } | |
296 | |
297 advance = x; | |
298 return adoptRef(builder.build()); | |
299 } | |
300 | |
301 | |
241 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to, bool accountForGlyphBounds) const | 302 FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point , int h, int from, int to, bool accountForGlyphBounds) const |
242 { | 303 { |
243 to = (to == -1 ? run.length() : to); | 304 to = (to == -1 ? run.length() : to); |
244 | 305 |
245 CodePath codePathToUse = codePath(run); | 306 CodePath codePathToUse = codePath(run); |
246 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 | 307 // FIXME: Use the fast code path once it handles partial runs with kerning a nd ligatures. See http://webkit.org/b/100050 |
247 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (from || to != run.length())) | 308 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (from || to != run.length())) |
248 codePathToUse = ComplexPath; | 309 codePathToUse = ComplexPath; |
249 | 310 |
250 if (codePathToUse != ComplexPath) | 311 if (codePathToUse != ComplexPath) |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRu nPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const | 780 void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRu nPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const |
720 { | 781 { |
721 GlyphBuffer glyphBuffer; | 782 GlyphBuffer glyphBuffer; |
722 float initialAdvance = getGlyphsAndAdvancesForSimpleText(runInfo, glyphBuffe r, ForTextEmphasis); | 783 float initialAdvance = getGlyphsAndAdvancesForSimpleText(runInfo, glyphBuffe r, ForTextEmphasis); |
723 | 784 |
724 if (glyphBuffer.isEmpty()) | 785 if (glyphBuffer.isEmpty()) |
725 return; | 786 return; |
726 | 787 |
727 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); | 788 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); |
728 } | 789 } |
729 | 790 |
Dominik Röttsches
2014/10/02 13:34:39
nit, extra newline?
eae
2014/10/02 14:28:50
Done.
| |
730 float Font::drawGlyphBuffer(GraphicsContext* context, const TextRunPaintInfo& ru nInfo, const GlyphBuffer& glyphBuffer, const FloatPoint& point) const | 791 |
792 static SkPaint textFillPaint(GraphicsContext* gc, const SimpleFontData* font) | |
793 { | |
794 SkPaint paint = gc->fillPaint(); | |
795 font->platformData().setupPaint(&paint, gc); | |
796 gc->adjustTextRenderMode(&paint); | |
797 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | |
798 return paint; | |
799 } | |
800 | |
801 static SkPaint textStrokePaint(GraphicsContext* gc, const SimpleFontData* font, bool isFilling) | |
802 { | |
803 SkPaint paint = gc->strokePaint(); | |
804 font->platformData().setupPaint(&paint, gc); | |
805 gc->adjustTextRenderMode(&paint); | |
806 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | |
807 if (isFilling) { | |
808 // If there is a shadow and we filled above, there will already be | |
809 // a shadow. We don't want to draw it again or it will be too dark | |
810 // and it will go on top of the fill. | |
811 // | |
812 // Note that this isn't strictly correct, since the stroke could be | |
813 // very thick and the shadow wouldn't account for this. The "right" | |
814 // thing would be to draw to a new layer and then draw that layer | |
815 // with a shadow. But this is a lot of extra work for something | |
816 // that isn't normally an issue. | |
817 paint.setLooper(0); | |
818 } | |
819 return paint; | |
820 } | |
821 | |
822 static void paintGlyphs(GraphicsContext* gc, const SimpleFontData* font, | |
823 const Glyph glyphs[], unsigned numGlyphs, | |
824 const SkPoint pos[], const FloatRect& textRect) | |
825 { | |
826 TextDrawingModeFlags textMode = gc->textDrawingMode(); | |
827 | |
828 // We draw text up to two times (once for fill, once for stroke). | |
829 if (textMode & TextModeFill) { | |
830 SkPaint paint = textFillPaint(gc, font); | |
831 gc->drawPosText(glyphs, numGlyphs * sizeof(Glyph), pos, textRect, paint) ; | |
832 } | |
833 | |
834 if ((textMode & TextModeStroke) && gc->hasStroke()) { | |
835 SkPaint paint = textStrokePaint(gc, font, textMode & TextModeFill); | |
836 gc->drawPosText(glyphs, numGlyphs * sizeof(Glyph), pos, textRect, paint) ; | |
837 } | |
838 } | |
839 | |
840 static void paintGlyphsHorizontal(GraphicsContext* gc, const SimpleFontData* fon t, | |
841 const Glyph glyphs[], unsigned numGlyphs, | |
842 const SkScalar xpos[], SkScalar constY, const FloatRect& textRect) | |
843 { | |
844 TextDrawingModeFlags textMode = gc->textDrawingMode(); | |
845 | |
846 if (textMode & TextModeFill) { | |
847 SkPaint paint = textFillPaint(gc, font); | |
848 gc->drawPosTextH(glyphs, numGlyphs * sizeof(Glyph), xpos, constY, textRe ct, paint); | |
849 } | |
850 | |
851 if ((textMode & TextModeStroke) && gc->hasStroke()) { | |
852 SkPaint paint = textStrokePaint(gc, font, textMode & TextModeFill); | |
853 gc->drawPosTextH(glyphs, numGlyphs * sizeof(Glyph), xpos, constY, textRe ct, paint); | |
854 } | |
855 } | |
856 | |
857 void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, | |
858 const GlyphBuffer& glyphBuffer, unsigned from, unsigned numGlyphs, | |
859 const FloatPoint& point, const FloatRect& textRect) const | |
860 { | |
861 SkScalar x = SkFloatToScalar(point.x()); | |
862 SkScalar y = SkFloatToScalar(point.y()); | |
863 | |
864 const OpenTypeVerticalData* verticalData = font->verticalData(); | |
865 if (font->platformData().orientation() == Vertical && verticalData) { | |
866 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); | |
867 SkPoint* pos = storage.get(); | |
868 | |
869 AffineTransform savedMatrix = gc->getCTM(); | |
870 gc->concatCTM(AffineTransform(0, -1, 1, 0, point.x(), point.y())); | |
871 gc->concatCTM(AffineTransform(1, 0, 0, 1, -point.x(), -point.y())); | |
872 | |
873 const unsigned kMaxBufferLength = 256; | |
874 Vector<FloatPoint, kMaxBufferLength> translations; | |
875 | |
876 const FontMetrics& metrics = font->fontMetrics(); | |
877 SkScalar verticalOriginX = SkFloatToScalar(point.x() + metrics.floatAsce nt() - metrics.floatAscent(IdeographicBaseline)); | |
878 float horizontalOffset = point.x(); | |
879 | |
880 unsigned glyphIndex = 0; | |
881 while (glyphIndex < numGlyphs) { | |
882 unsigned chunkLength = std::min(kMaxBufferLength, numGlyphs - glyphI ndex); | |
883 | |
884 const Glyph* glyphs = glyphBuffer.glyphs(from + glyphIndex); | |
885 translations.resize(chunkLength); | |
886 verticalData->getVerticalTranslationsForGlyphs(font, &glyphs[0], chu nkLength, reinterpret_cast<float*>(&translations[0])); | |
887 | |
888 x = verticalOriginX; | |
889 y = SkFloatToScalar(point.y() + horizontalOffset - point.x()); | |
890 | |
891 float currentWidth = 0; | |
892 for (unsigned i = 0; i < chunkLength; ++i, ++glyphIndex) { | |
893 pos[i].set( | |
894 x + SkIntToScalar(lroundf(translations[i].x())), | |
895 y + -SkIntToScalar(-lroundf(currentWidth - translations[i].y ()))); | |
896 currentWidth += glyphBuffer.advanceAt(from + glyphIndex); | |
897 } | |
898 horizontalOffset += currentWidth; | |
899 paintGlyphs(gc, font, glyphs, chunkLength, pos, textRect); | |
900 } | |
901 | |
902 gc->setCTM(savedMatrix); | |
903 return; | |
904 } | |
905 | |
906 if (!glyphBuffer.hasOffsets()) { | |
907 SkAutoSTMalloc<64, SkScalar> storage(numGlyphs); | |
908 SkScalar* xpos = storage.get(); | |
909 const float* adv = glyphBuffer.advances(from); | |
910 for (unsigned i = 0; i < numGlyphs; i++) { | |
911 xpos[i] = x; | |
912 x += SkFloatToScalar(adv[i]); | |
913 } | |
914 const Glyph* glyphs = glyphBuffer.glyphs(from); | |
915 paintGlyphsHorizontal(gc, font, glyphs, numGlyphs, xpos, SkFloatToScalar (y), textRect); | |
916 return; | |
917 } | |
918 | |
919 ASSERT(glyphBuffer.hasOffsets()); | |
920 const GlyphBufferWithOffsets& glyphBufferWithOffsets = | |
921 static_cast<const GlyphBufferWithOffsets&>(glyphBuffer); | |
922 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); | |
923 SkPoint* pos = storage.get(); | |
924 const FloatSize* offsets = glyphBufferWithOffsets.offsets(from); | |
925 const float* advances = glyphBufferWithOffsets.advances(from); | |
926 SkScalar advanceSoFar = SkFloatToScalar(0); | |
927 for (unsigned i = 0; i < numGlyphs; i++) { | |
928 pos[i].set( | |
929 x + SkFloatToScalar(offsets[i].width()) + advanceSoFar, | |
930 y + SkFloatToScalar(offsets[i].height())); | |
931 advanceSoFar += SkFloatToScalar(advances[i]); | |
932 } | |
933 | |
934 const Glyph* glyphs = glyphBufferWithOffsets.glyphs(from); | |
935 paintGlyphs(gc, font, glyphs, numGlyphs, pos, textRect); | |
936 } | |
937 | |
938 void Font::drawTextBlob(GraphicsContext* gc, const SkTextBlob* blob, const SkPoi nt& origin) const | |
939 { | |
940 ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); | |
941 | |
942 // FIXME: It would be good to move this to Font.cpp, if we're sure that none | |
943 // of the things in FontMac's setupPaint need to apply here. | |
944 // See also paintGlyphs. | |
945 TextDrawingModeFlags textMode = gc->textDrawingMode(); | |
946 | |
947 if (textMode & TextModeFill) | |
948 gc->drawTextBlob(blob, origin, gc->fillPaint()); | |
949 | |
950 if ((textMode & TextModeStroke) && gc->hasStroke()) { | |
951 SkPaint paint = gc->strokePaint(); | |
952 if (textMode & TextModeFill) | |
953 paint.setLooper(0); | |
954 gc->drawTextBlob(blob, origin, paint); | |
955 } | |
956 } | |
957 | |
958 float Font::drawComplexText(GraphicsContext* gc, const TextRunPaintInfo& runInfo , const FloatPoint& point) const | |
959 { | |
960 if (!runInfo.run.length()) | |
961 return 0; | |
962 | |
963 TextDrawingModeFlags textMode = gc->textDrawingMode(); | |
964 bool fill = textMode & TextModeFill; | |
965 bool stroke = (textMode & TextModeStroke) && gc->hasStroke(); | |
966 | |
967 if (!fill && !stroke) | |
968 return 0; | |
969 | |
970 GlyphBufferWithOffsets glyphBuffer; | |
971 HarfBuzzShaper shaper(this, runInfo.run); | |
972 shaper.setDrawRange(runInfo.from, runInfo.to); | |
973 if (!shaper.shape(&glyphBuffer) || glyphBuffer.isEmpty()) | |
974 return 0; | |
975 return drawGlyphBuffer(gc, runInfo, glyphBuffer, point); | |
976 } | |
977 | |
978 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const | |
979 { | |
980 GlyphBuffer glyphBuffer; | |
981 | |
982 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo, glyphBuff er, ForTextEmphasis); | |
983 | |
984 if (glyphBuffer.isEmpty()) | |
985 return; | |
986 | |
987 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); | |
988 } | |
989 | |
990 float Font::getGlyphsAndAdvancesForComplexText(const TextRunPaintInfo& runInfo, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const | |
991 { | |
992 HarfBuzzShaper shaper(this, runInfo.run, HarfBuzzShaper::ForTextEmphasis); | |
993 shaper.setDrawRange(runInfo.from, runInfo.to); | |
994 shaper.shape(&glyphBuffer); | |
995 return 0; | |
996 } | |
997 | |
998 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, IntRectExtent* glyphBounds) const | |
999 { | |
1000 HarfBuzzShaper shaper(this, run, HarfBuzzShaper::NotForTextEmphasis, fallbac kFonts); | |
1001 if (!shaper.shape()) | |
1002 return 0; | |
1003 | |
1004 glyphBounds->setTop(floorf(-shaper.glyphBoundingBox().top())); | |
1005 glyphBounds->setBottom(ceilf(shaper.glyphBoundingBox().bottom())); | |
1006 glyphBounds->setLeft(std::max<int>(0, floorf(-shaper.glyphBoundingBox().left ()))); | |
1007 glyphBounds->setRight(std::max<int>(0, ceilf(shaper.glyphBoundingBox().right () - shaper.totalWidth()))); | |
1008 | |
1009 return shaper.totalWidth(); | |
1010 } | |
1011 | |
1012 // Return the code point index for the given |x| offset into the text run. | |
1013 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, | |
1014 bool includePartialGlyphs) const | |
1015 { | |
1016 HarfBuzzShaper shaper(this, run); | |
1017 if (!shaper.shape()) | |
1018 return 0; | |
1019 return shaper.offsetForPosition(xFloat); | |
1020 } | |
1021 | |
1022 // Return the rectangle for selecting the given range of code-points in the Text Run. | |
1023 FloatRect Font::selectionRectForComplexText(const TextRun& run, | |
1024 const FloatPoint& point, int height, int from, int to) const | |
1025 { | |
1026 HarfBuzzShaper shaper(this, run); | |
1027 if (!shaper.shape()) | |
1028 return FloatRect(); | |
1029 return shaper.selectionRect(point, height, from, to); | |
1030 } | |
1031 | |
1032 float Font::drawGlyphBuffer(GraphicsContext* context, | |
1033 const TextRunPaintInfo& runInfo, const GlyphBuffer& glyphBuffer, | |
1034 const FloatPoint& point) const | |
731 { | 1035 { |
732 // Draw each contiguous run of glyphs that use the same font data. | 1036 // Draw each contiguous run of glyphs that use the same font data. |
733 const SimpleFontData* fontData = glyphBuffer.fontDataAt(0); | 1037 const SimpleFontData* fontData = glyphBuffer.fontDataAt(0); |
734 FloatPoint startPoint(point); | 1038 FloatPoint startPoint(point); |
735 float advanceSoFar = 0; | 1039 float advanceSoFar = 0; |
736 unsigned lastFrom = 0; | 1040 unsigned lastFrom = 0; |
737 unsigned nextGlyph = 0; | 1041 unsigned nextGlyph = 0; |
738 #if ENABLE(SVG_FONTS) | 1042 #if ENABLE(SVG_FONTS) |
739 TextRun::RenderingContext* renderingContext = runInfo.run.renderingContext() ; | 1043 TextRun::RenderingContext* renderingContext = runInfo.run.renderingContext() ; |
740 #endif | 1044 #endif |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 if (delta <= 0) | 1203 if (delta <= 0) |
900 break; | 1204 break; |
901 } | 1205 } |
902 } | 1206 } |
903 } | 1207 } |
904 | 1208 |
905 return offset; | 1209 return offset; |
906 } | 1210 } |
907 | 1211 |
908 } // namespace blink | 1212 } // namespace blink |
OLD | NEW |