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

Side by Side Diff: Source/core/platform/graphics/win/UniscribeHelperTextRun.h

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef UniscribeHelperTextRun_h
32 #define UniscribeHelperTextRun_h
33
34 #include "core/platform/graphics/win/UniscribeHelper.h"
35 #include "wtf/text/WTFString.h"
36
37 namespace WebCore {
38
39 class Font;
40 class TextRun;
41
42 // Wrapper around the Uniscribe helper that automatically sets it up with the
43 // WebKit types we supply.
44 class UniscribeHelperTextRun : public UniscribeHelper {
45 public:
46 // Regular constructor used for WebCore text run processing.
47 UniscribeHelperTextRun(const TextRun&, const Font&);
48
49 // Constructor with the same interface as the gfx::UniscribeState. Using
50 // this constructor will not give you font fallback, but it will provide
51 // the ability to load fonts that may not be in the OS cache
52 // ("TryToPreloadFont") if the caller does not have a TextRun/Font.
53 UniscribeHelperTextRun(const wchar_t* input,
54 int inputLength,
55 bool isRtl,
56 HFONT hfont,
57 SCRIPT_CACHE*,
58 SCRIPT_FONTPROPERTIES*);
59
60 protected:
61 virtual void tryToPreloadFont(HFONT);
62
63 private:
64 // This function retrieves the Windows font data (HFONT, etc) for the next
65 // WebKit font in the list. If the font data corresponding to font_index_
66 // has been obtained before, returns the values stored in our internal
67 // vectors (hfonts_, etc). Otherwise, it gets next SimpleFontData from
68 // WebKit and adds them to in hfonts_ and friends so that font data can be
69 // returned quickly next time they're requested.
70 virtual bool nextWinFontData(HFONT&, SCRIPT_CACHE*&, SCRIPT_FONTPROPERTIES*& , int& ascent, WORD& spaceGlyph);
71 virtual void resetFontIndex();
72
73 // Reference to blink::Font that contains all the information about fonts
74 // we can use to render this input run of text. It is used in
75 // NextWinFontData to retrieve Windows font data for a series of
76 // non-primary fonts.
77 //
78 // This pointer can be NULL for no font fallback handling.
79 const Font* m_font;
80
81 // When we have an 8 bit TestRun, we store the buffer of upconverted charact ers
82 // in this string.
83 String m_stringFor8BitRun;
84
85 // It's rare that many fonts are listed in stylesheets.
86 // Four would be large enough in most cases.
87 const static size_t kNumberOfFonts = 4;
88
89 // These vectors are used to store Windows font data for non-primary fonts.
90 Vector<HFONT, kNumberOfFonts> m_hfonts;
91 Vector<SCRIPT_CACHE*, kNumberOfFonts> m_scriptCaches;
92 Vector<SCRIPT_FONTPROPERTIES*, kNumberOfFonts> m_fontProperties;
93 Vector<int, kNumberOfFonts> m_ascents;
94 Vector<WORD> m_spaceGlyphs;
95
96 // Index of the fallback font we're currently using for NextWinFontData.
97 int m_fontIndex;
98 };
99
100 } // namespace WebCore
101
102 #endif // UniscribeHelperTextRun_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/win/UniscribeHelper.cpp ('k') | Source/core/platform/graphics/win/UniscribeHelperTextRun.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698