| 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 29 matching lines...) Expand all Loading... |
| 40 struct GlyphData; | 40 struct GlyphData; |
| 41 | 41 |
| 42 struct PLATFORM_EXPORT SimpleShaper : public Shaper { | 42 struct PLATFORM_EXPORT SimpleShaper : public Shaper { |
| 43 public: | 43 public: |
| 44 SimpleShaper(const Font*, | 44 SimpleShaper(const Font*, |
| 45 const TextRun&, | 45 const TextRun&, |
| 46 const GlyphData* emphasisData = nullptr, | 46 const GlyphData* emphasisData = nullptr, |
| 47 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, | 47 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, |
| 48 FloatRect* = nullptr); | 48 FloatRect* = nullptr); |
| 49 | 49 |
| 50 // TODO(sk.kumar): This function should be updated to take an unsigned value,
and callers | 50 // TODO(sk.kumar): This function should be updated to take an unsigned value, |
| 51 // should be updated to not pass negative values. See: crbug.com/540047. | 51 // and callers should be updated to not pass negative values. |
| 52 // See: crbug.com/540047. |
| 52 unsigned advance(int to, GlyphBuffer* = 0); | 53 unsigned advance(int to, GlyphBuffer* = 0); |
| 53 bool advanceOneCharacter(float& width); | 54 bool advanceOneCharacter(float& width); |
| 54 | 55 |
| 55 const TextRun& run() const { return m_textRun; } | 56 const TextRun& run() const { return m_textRun; } |
| 56 float runWidthSoFar() const { return m_runWidthSoFar; } | 57 float runWidthSoFar() const { return m_runWidthSoFar; } |
| 57 unsigned currentOffset() { return m_currentCharacter; } | 58 unsigned currentOffset() { return m_currentCharacter; } |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 unsigned m_currentCharacter; | 61 unsigned m_currentCharacter; |
| 61 float m_runWidthSoFar; | 62 float m_runWidthSoFar; |
| 62 | 63 |
| 63 struct CharacterData { | 64 struct CharacterData { |
| 64 STACK_ALLOCATED(); | 65 STACK_ALLOCATED(); |
| 65 UChar32 character; | 66 UChar32 character; |
| 66 unsigned clusterLength; | 67 unsigned clusterLength; |
| 67 int characterOffset; | 68 int characterOffset; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false); | 71 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false); |
| 71 float characterWidth(UChar32, const GlyphData&) const; | 72 float characterWidth(UChar32, const GlyphData&) const; |
| 72 float adjustSpacing(float, const CharacterData&); | 73 float adjustSpacing(float, const CharacterData&); |
| 73 | 74 |
| 74 template <typename TextIterator> | 75 template <typename TextIterator> |
| 75 unsigned advanceInternal(TextIterator&, GlyphBuffer*); | 76 unsigned advanceInternal(TextIterator&, GlyphBuffer*); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // namespace blink | 79 } // namespace blink |
| 79 | 80 |
| 80 #endif | 81 #endif |
| OLD | NEW |