Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.h

Issue 2740083002: Add support for shaper-driven line breaking to HarfBuzzShaper (Closed)
Patch Set: Try to fix test failures Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698