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 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 // Return the rectangle for selecting the given range of code-points in the Text
Run. | 746 // Return the rectangle for selecting the given range of code-points in the Text
Run. |
747 FloatRect Font::selectionRectForComplexText(const TextRun& run, | 747 FloatRect Font::selectionRectForComplexText(const TextRun& run, |
748 const FloatPoint& point, int height, int from, int to) const | 748 const FloatPoint& point, int height, int from, int to) const |
749 { | 749 { |
750 CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription)); | 750 CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription)); |
751 CharacterRange range = shaper.getCharacterRange(this, run, from, to); | 751 CharacterRange range = shaper.getCharacterRange(this, run, from, to); |
752 return FloatRect(point.x() + range.start, point.y(), range.width(), height); | 752 return FloatRect(point.x() + range.start, point.y(), range.width(), height); |
753 } | 753 } |
754 | 754 |
| 755 Vector<CharacterRange> Font::individualCharacterRanges(const TextRun& run, |
| 756 int from, int to) const |
| 757 { |
| 758 // TODO(pdr): Android is temporarily (crbug.com/577306) using the old simple |
| 759 // shaper and using the complex shaper here can show differences between |
| 760 // the two shapers. This function is currently only called through SVG |
| 761 // which now exclusively uses the complex shaper, so the primary difference |
| 762 // will be improved shaping in SVG when compared to HTML. |
| 763 FontCachePurgePreventer purgePreventer; |
| 764 CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription)); |
| 765 return shaper.individualCharacterRanges(this, run, from, to); |
| 766 } |
| 767 |
755 float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFont
Data*>* fallbackFonts, FloatRect* glyphBounds) const | 768 float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFont
Data*>* fallbackFonts, FloatRect* glyphBounds) const |
756 { | 769 { |
757 SimpleShaper shaper(this, run, nullptr, fallbackFonts, glyphBounds); | 770 SimpleShaper shaper(this, run, nullptr, fallbackFonts, glyphBounds); |
758 shaper.advance(run.length()); | 771 shaper.advance(run.length()); |
759 return shaper.runWidthSoFar(); | 772 return shaper.runWidthSoFar(); |
760 } | 773 } |
761 | 774 |
762 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint&
point, int h, int from, int to, bool accountForGlyphBounds) const | 775 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint&
point, int h, int from, int to, bool accountForGlyphBounds) const |
763 { | 776 { |
764 FloatRect bounds; | 777 FloatRect bounds; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 { | 842 { |
830 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 843 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); |
831 } | 844 } |
832 | 845 |
833 bool Font::isFallbackValid() const | 846 bool Font::isFallbackValid() const |
834 { | 847 { |
835 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 848 return !m_fontFallbackList || m_fontFallbackList->isValid(); |
836 } | 849 } |
837 | 850 |
838 } // namespace blink | 851 } // namespace blink |
OLD | NEW |