Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h |
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h |
index 08c323534453050d56d5a14b4d3fe41fac889f52..e4d6c5843540d77e7ae6130570fc504f8e14beb7 100644 |
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h |
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h |
@@ -31,49 +31,61 @@ |
#ifndef HarfBuzzShaper_h |
#define HarfBuzzShaper_h |
+#include <hb.h> |
+#include <unicode/uscript.h> |
+#include <memory> |
+#include "platform/fonts/shaping/RunSegmenter.h" |
#include "platform/fonts/shaping/ShapeResult.h" |
#include "platform/text/TextRun.h" |
#include "wtf/Allocator.h" |
#include "wtf/Deque.h" |
#include "wtf/Vector.h" |
-#include <hb.h> |
-#include <memory> |
-#include <unicode/uscript.h> |
namespace blink { |
class Font; |
class SimpleFontData; |
class HarfBuzzShaper; |
+struct HolesQueueItem; |
class PLATFORM_EXPORT HarfBuzzShaper final { |
public: |
- HarfBuzzShaper(const UChar*, unsigned length, TextDirection); |
- PassRefPtr<ShapeResult> shapeResult(const Font*) const; |
+ HarfBuzzShaper(const UChar*, unsigned length); |
+ PassRefPtr<ShapeResult> shape(const Font*, |
+ TextDirection, |
+ unsigned start, |
+ unsigned end) const; |
+ PassRefPtr<ShapeResult> shape(const Font*, TextDirection) const; |
~HarfBuzzShaper() {} |
- enum HolesQueueItemAction { HolesQueueNextFont, HolesQueueRange }; |
+ private: |
+ using FeaturesVector = Vector<hb_feature_t, 6>; |
- struct HolesQueueItem { |
- DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
- HolesQueueItemAction m_action; |
- unsigned m_startIndex; |
- unsigned m_numCharacters; |
- HolesQueueItem(HolesQueueItemAction action, unsigned start, unsigned num) |
- : m_action(action), m_startIndex(start), m_numCharacters(num){}; |
- }; |
+ // Shapes a single seqment, as identified by the RunSegmenterRange parameter, |
drott
2017/02/07 23:12:41
Is this the codereview tool showing it in a funny
|
+ // one or more times taking font fallback into account. The start and end |
+ // parameters are for the entire text run, not the segment, and are used to |
+ // determine pre- and post-context for shaping. |
+ void shapeSegment(ShapeResult*, |
+ Deque<HolesQueueItem>*, |
+ hb_buffer_t*, |
+ const Font*, |
+ FeaturesVector*, |
+ RunSegmenter::RunSegmenterRange, |
+ unsigned start, |
+ unsigned end, |
+ TextDirection) const; |
- private: |
bool extractShapeResults(hb_buffer_t*, |
ShapeResult*, |
bool& fontCycleQueued, |
Deque<HolesQueueItem>*, |
const HolesQueueItem&, |
const Font*, |
+ TextDirection, |
const SimpleFontData*, |
UScriptCode, |
bool isLastResort) const; |
- bool collectFallbackHintChars(const Deque<HolesQueueItem>&, |
+ bool collectFallbackHintChars(const Deque<HolesQueueItem>*, |
Vector<UChar32>& hint) const; |
void insertRunIntoShapeResult( |
@@ -83,9 +95,8 @@ class PLATFORM_EXPORT HarfBuzzShaper final { |
unsigned numGlyphs, |
hb_buffer_t*); |
- const UChar* m_normalizedBuffer; |
- unsigned m_normalizedBufferLength; |
- TextDirection m_textDirection; |
+ const UChar* m_text; |
+ unsigned m_textLength; |
}; |
} // namespace blink |