Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "platform/fonts/shaping/ShapeResult.h" | 35 #include "platform/fonts/shaping/ShapeResult.h" |
| 36 #include "wtf/Allocator.h" | 36 #include "wtf/Allocator.h" |
| 37 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
| 38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class Font; | 42 class Font; |
| 43 class SimpleFontData; | 43 class SimpleFontData; |
| 44 class HarfBuzzShaper; | 44 class HarfBuzzShaper; |
| 45 class LayoutUnit; | |
| 45 struct HolesQueueItem; | 46 struct HolesQueueItem; |
| 47 enum class LineBreakType; | |
| 46 | 48 |
| 47 class PLATFORM_EXPORT HarfBuzzShaper final { | 49 class PLATFORM_EXPORT HarfBuzzShaper final { |
| 48 public: | 50 public: |
| 49 HarfBuzzShaper(const UChar*, unsigned length); | 51 HarfBuzzShaper(const UChar*, unsigned length); |
| 50 | 52 |
| 51 // Shape a range, defined by the start and end parameters, of the string | 53 // Shape a range, defined by the start and end parameters, of the string |
| 52 // supplied to the constructor. | 54 // supplied to the constructor. |
| 53 // The start and end positions should represent boundaries where a break may | 55 // The start and end positions should represent boundaries where a break may |
| 54 // occur, such as at the beginning or end of lines or at element boundaries. | 56 // occur, such as at the beginning or end of lines or at element boundaries. |
| 55 // If given arbitrary positions the results are not guaranteed to be correct. | 57 // If given arbitrary positions the results are not guaranteed to be correct. |
| 56 // May be called multiple times; font and direction may vary between calls. | 58 // May be called multiple times; font and direction may vary between calls. |
| 57 PassRefPtr<ShapeResult> shape(const Font*, | 59 PassRefPtr<ShapeResult> shape(const Font*, |
| 58 TextDirection, | 60 TextDirection, |
| 59 unsigned start, | 61 unsigned start, |
| 60 unsigned end) const; | 62 unsigned end) const; |
| 61 | 63 |
| 62 // Shape the entire string with a single font and direction. | 64 // Shape the entire string with a single font and direction. |
| 63 // Equivalent to calling the range version with a start offset of zero and an | 65 // Equivalent to calling the range version with a start offset of zero and an |
| 64 // end offset equal to the length. | 66 // end offset equal to the length. |
| 65 PassRefPtr<ShapeResult> shape(const Font*, TextDirection) const; | 67 PassRefPtr<ShapeResult> shape(const Font*, TextDirection) const; |
| 66 | 68 |
| 69 // Shapes a line of text by finding a valid and appropriate break opportunity | |
| 70 // based on the shaping results for the entire paragraph. | |
| 71 // The output parameter breakOffset indicates the resulting break offset. | |
| 72 PassRefPtr<ShapeResult> shapeLine(const Font*, | |
| 73 const ShapeResult*, | |
| 74 unsigned startOffset, | |
| 75 const AtomicString locale, | |
|
jbroman
2017/03/21 21:30:08
drive-by: const AtomicString&? (this currently unn
| |
| 76 LineBreakType, | |
| 77 LayoutUnit availableSpace, | |
| 78 unsigned* breakOffset) const; | |
| 79 | |
| 67 ~HarfBuzzShaper() {} | 80 ~HarfBuzzShaper() {} |
| 68 | 81 |
| 69 private: | 82 private: |
| 70 struct RangeData; | 83 struct RangeData; |
| 71 | 84 |
| 72 // Shapes a single seqment, as identified by the RunSegmenterRange parameter, | 85 // Shapes a single seqment, as identified by the RunSegmenterRange parameter, |
| 73 // one or more times taking font fallback into account. The start and end | 86 // one or more times taking font fallback into account. The start and end |
| 74 // parameters are for the entire text run, not the segment, and are used to | 87 // parameters are for the entire text run, not the segment, and are used to |
| 75 // determine pre- and post-context for shaping. | 88 // determine pre- and post-context for shaping. |
| 76 void shapeSegment(RangeData*, | 89 void shapeSegment(RangeData*, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 88 bool collectFallbackHintChars(const Deque<HolesQueueItem>&, | 101 bool collectFallbackHintChars(const Deque<HolesQueueItem>&, |
| 89 Vector<UChar32>& hint) const; | 102 Vector<UChar32>& hint) const; |
| 90 | 103 |
| 91 const UChar* m_text; | 104 const UChar* m_text; |
| 92 unsigned m_textLength; | 105 unsigned m_textLength; |
| 93 }; | 106 }; |
| 94 | 107 |
| 95 } // namespace blink | 108 } // namespace blink |
| 96 | 109 |
| 97 #endif // HarfBuzzShaper_h | 110 #endif // HarfBuzzShaper_h |
| OLD | NEW |