OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
4 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 27 matching lines...) Expand all Loading... |
38 class SimpleFontData; | 38 class SimpleFontData; |
39 class TextRun; | 39 class TextRun; |
40 struct GlyphData; | 40 struct GlyphData; |
41 | 41 |
42 struct PLATFORM_EXPORT SimpleShaper : public Shaper { | 42 struct PLATFORM_EXPORT SimpleShaper : public Shaper { |
43 WTF_MAKE_FAST_ALLOCATED(SimpleShaper); | 43 WTF_MAKE_FAST_ALLOCATED(SimpleShaper); |
44 public: | 44 public: |
45 SimpleShaper(const Font*, const TextRun&, const GlyphData* emphasisData = nu
llptr, | 45 SimpleShaper(const Font*, const TextRun&, const GlyphData* emphasisData = nu
llptr, |
46 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* = nu
llptr); | 46 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* = nu
llptr); |
47 | 47 |
48 unsigned advance(unsigned to, GlyphBuffer* = 0); | 48 // TODO(sk.kumar): This function should be updated to take an unsigned value
, and callers |
| 49 // should be updated to not pass negative values. See: crbug.com/540047. |
| 50 unsigned advance(int to, GlyphBuffer* = 0); |
49 bool advanceOneCharacter(float& width); | 51 bool advanceOneCharacter(float& width); |
50 | 52 |
51 const TextRun& run() const { return m_textRun; } | 53 const TextRun& run() const { return m_textRun; } |
52 float runWidthSoFar() const { return m_runWidthSoFar; } | 54 float runWidthSoFar() const { return m_runWidthSoFar; } |
53 unsigned currentOffset() { return m_currentCharacter; } | 55 unsigned currentOffset() { return m_currentCharacter; } |
54 | 56 |
55 private: | 57 private: |
56 unsigned m_currentCharacter; | 58 unsigned m_currentCharacter; |
57 float m_runWidthSoFar; | 59 float m_runWidthSoFar; |
58 | 60 |
59 struct CharacterData { | 61 struct CharacterData { |
60 UChar32 character; | 62 UChar32 character; |
61 unsigned clusterLength; | 63 unsigned clusterLength; |
62 int characterOffset; | 64 int characterOffset; |
63 }; | 65 }; |
64 | 66 |
65 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false)
; | 67 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false)
; |
66 float characterWidth(UChar32, const GlyphData&) const; | 68 float characterWidth(UChar32, const GlyphData&) const; |
67 float adjustSpacing(float, const CharacterData&); | 69 float adjustSpacing(float, const CharacterData&); |
68 | 70 |
69 template <typename TextIterator> | 71 template <typename TextIterator> |
70 unsigned advanceInternal(TextIterator&, GlyphBuffer*); | 72 unsigned advanceInternal(TextIterator&, GlyphBuffer*); |
71 }; | 73 }; |
72 | 74 |
73 } // namespace blink | 75 } // namespace blink |
74 | 76 |
75 #endif | 77 #endif |
OLD | NEW |