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

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

Issue 1479003002: Remove Simple Text Path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 1 month 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2003, 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Holger Hans Peter Freyther
4 * Copyright (C) 2014 Google Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #ifndef SimpleShaper_h
24 #define SimpleShaper_h
25
26 #include "platform/PlatformExport.h"
27 #include "platform/fonts/shaping/Shaper.h"
28 #include "platform/geometry/FloatPoint.h"
29 #include "platform/geometry/FloatRect.h"
30 #include "platform/text/TextRun.h"
31 #include "wtf/HashSet.h"
32 #include "wtf/text/Unicode.h"
33
34 namespace blink {
35
36 class Font;
37 class GlyphBuffer;
38 class SimpleFontData;
39 class TextRun;
40 struct GlyphData;
41
42 struct PLATFORM_EXPORT SimpleShaper : public Shaper {
43 public:
44 SimpleShaper(const Font*,
45 const TextRun&,
46 const GlyphData* emphasisData = nullptr,
47 HashSet<const SimpleFontData*>* fallbackFonts = nullptr,
48 FloatRect* = nullptr);
49
50 // TODO(sk.kumar): This function should be updated to take an unsigned value,
51 // and callers should be updated to not pass negative values.
52 // See: crbug.com/540047.
53 unsigned advance(int to, GlyphBuffer* = 0);
54 bool advanceOneCharacter(float& width);
55
56 const TextRun& run() const { return m_textRun; }
57 float runWidthSoFar() const { return m_runWidthSoFar; }
58 unsigned currentOffset() { return m_currentCharacter; }
59
60 private:
61 unsigned m_currentCharacter;
62 float m_runWidthSoFar;
63
64 struct CharacterData {
65 STACK_ALLOCATED();
66 UChar32 character;
67 unsigned clusterLength;
68 int characterOffset;
69 };
70
71 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false);
72 float characterWidth(UChar32, const GlyphData&) const;
73 float adjustSpacing(float, const CharacterData&);
74
75 template <typename TextIterator>
76 unsigned advanceInternal(TextIterator&, GlyphBuffer*);
77 };
78
79 } // namespace blink
80
81 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698