| 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 7db9bcb48b7cbc1dc2b0b971e8baaa44cdd47ecb..9031c8aac5a08bdbceabbc129904d41729a45234 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
|
| +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h
|
| @@ -31,39 +31,57 @@
|
| #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() {}
|
|
|
| - enum HolesQueueItemAction { HolesQueueNextFont, HolesQueueRange };
|
| + // Shape a range, defined by the start and end parameters, of the string
|
| + // supplied to the constructor. May be called multiple times and the font may
|
| + // may vary between calls.
|
| + PassRefPtr<ShapeResult> shape(const Font*,
|
| + unsigned start,
|
| + unsigned end) const;
|
| +
|
| + // Shape the entire string with a single font..
|
| + // Equivalent to calling the range version with a start offset of zero and an
|
| + // end offset equal to the length.
|
| + PassRefPtr<ShapeResult> shape(const Font*) const;
|
|
|
| - 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){};
|
| - };
|
| + ~HarfBuzzShaper() {}
|
|
|
| private:
|
| + using FeaturesVector = Vector<hb_feature_t, 6>;
|
| +
|
| + // Shapes a single seqment, as identified by the RunSegmenterRange parameter,
|
| + // 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) const;
|
| +
|
| bool extractShapeResults(hb_buffer_t*,
|
| ShapeResult*,
|
| bool& fontCycleQueued,
|
| @@ -73,12 +91,12 @@ class PLATFORM_EXPORT HarfBuzzShaper final {
|
| const SimpleFontData*,
|
| UScriptCode,
|
| bool isLastResort) const;
|
| - bool collectFallbackHintChars(const Deque<HolesQueueItem>&,
|
| + bool collectFallbackHintChars(const Deque<HolesQueueItem>*,
|
| Vector<UChar32>& hint) const;
|
|
|
| - const UChar* m_normalizedBuffer;
|
| - unsigned m_normalizedBufferLength;
|
| - TextDirection m_textDirection;
|
| + const UChar* m_text;
|
| + unsigned m_textLength;
|
| + TextDirection m_paragraphDirection;
|
| };
|
|
|
| } // namespace blink
|
|
|