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

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

Issue 1088093005: Unit tests for HarfBuzzShaper (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "wtf/unicode/CharacterNames.h" 43 #include "wtf/unicode/CharacterNames.h"
44 44
45 #include <unicode/uscript.h> 45 #include <unicode/uscript.h>
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class Font; 49 class Font;
50 class GlyphBuffer; 50 class GlyphBuffer;
51 class SimpleFontData; 51 class SimpleFontData;
52 52
53 class HarfBuzzShaper final : public Shaper { 53 class PLATFORM_EXPORT HarfBuzzShaper final : public Shaper {
54 public: 54 public:
55 HarfBuzzShaper(const Font*, const TextRun&, const GlyphData* emphasisData = nullptr, 55 HarfBuzzShaper(const Font*, const TextRun&, const GlyphData* emphasisData = nullptr,
56 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* = nu llptr); 56 HashSet<const SimpleFontData*>* fallbackFonts = nullptr, FloatRect* = nu llptr);
57 57
58 void setDrawRange(int from, int to); 58 void setDrawRange(int from, int to);
59 bool shape(GlyphBuffer* = 0); 59 bool shape(GlyphBuffer* = 0);
60 float totalWidth() { return m_totalWidth; } 60 float totalWidth() { return m_totalWidth; }
61 int offsetForPosition(float targetX); 61 int offsetForPosition(float targetX);
62 FloatRect selectionRect(const FloatPoint&, int height, int from, int to); 62 FloatRect selectionRect(const FloatPoint&, int height, int from, int to);
63 63
64 unsigned numberOfRunsForTesting() const
65 {
66 return m_harfBuzzRuns.size();
67 }
68
69 bool runInfoForTesting(unsigned runIndex, unsigned& startIndex,
Dominik Röttsches 2015/04/22 14:17:51 You preferred reference parameters here - I was wo
70 unsigned& numGlyphs, hb_script_t& script)
71 {
72 if (runIndex < m_harfBuzzRuns.size()) {
73 startIndex = m_harfBuzzRuns[runIndex]->startIndex();
74 numGlyphs = m_harfBuzzRuns[runIndex]->numGlyphs();
75 script = m_harfBuzzRuns[runIndex]->script();
76 return true;
77 }
78 return false;
79 }
80
64 private: 81 private:
65 class HarfBuzzRun { 82 class HarfBuzzRun {
66 public: 83 public:
67 HarfBuzzRun(const HarfBuzzRun&); 84 HarfBuzzRun(const HarfBuzzRun&);
68 ~HarfBuzzRun(); 85 ~HarfBuzzRun();
69 86
70 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t script) 87 static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, un signed startIndex, unsigned numCharacters, hb_direction_t direction, hb_script_t script)
71 { 88 {
72 return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction, script)); 89 return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction, script));
73 } 90 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 int m_toIndex; 161 int m_toIndex;
145 162
146 float m_totalWidth; 163 float m_totalWidth;
147 164
148 friend struct CachedShapingResults; 165 friend struct CachedShapingResults;
149 }; 166 };
150 167
151 } // namespace blink 168 } // namespace blink
152 169
153 #endif // HarfBuzzShaper_h 170 #endif // HarfBuzzShaper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698