OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // 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 17 matching lines...) Expand all Loading... |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include <windows.h> | 31 #include <windows.h> |
32 #include <vector> | 32 #include <vector> |
33 | 33 |
34 #include "ChromiumBridge.h" | 34 #include "ChromiumBridge.h" |
35 #include "Font.h" | 35 #include "Font.h" |
36 #include "GlyphPageTreeNode.h" | 36 #include "GlyphPageTreeNode.h" |
37 #include "SimpleFontData.h" | 37 #include "SimpleFontData.h" |
38 #include "UniscribeStateTextRun.h" | 38 #include "UniscribeHelperTextRun.h" |
39 | 39 |
40 #include "base/win_util.h" | 40 #include "base/win_util.h" |
41 | 41 |
42 namespace WebCore | 42 namespace WebCore |
43 { | 43 { |
44 | 44 |
45 // Fills one page of font data pointers with NULL to indicate that there | 45 // Fills one page of font data pointers with NULL to indicate that there |
46 // are no glyphs for the characters. | 46 // are no glyphs for the characters. |
47 static void FillEmptyGlyphs(GlyphPage* page) { | 47 static void FillEmptyGlyphs(GlyphPage* page) { |
48 for (int i = 0; i < GlyphPage::size; ++i) | 48 for (int i = 0; i < GlyphPage::size; ++i) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // the glyph indices back out that correspond to the correct input characters, | 189 // the glyph indices back out that correspond to the correct input characters, |
190 // since they may be missing. | 190 // since they may be missing. |
191 // | 191 // |
192 // Returns true if any glyphs were found. | 192 // Returns true if any glyphs were found. |
193 static bool FillNonBMPGlyphs(UChar* buffer, | 193 static bool FillNonBMPGlyphs(UChar* buffer, |
194 GlyphPage* page, | 194 GlyphPage* page, |
195 const SimpleFontData* fontData) | 195 const SimpleFontData* fontData) |
196 { | 196 { |
197 bool have_glyphs = false; | 197 bool have_glyphs = false; |
198 | 198 |
199 UniscribeStateTextRun state(buffer, GlyphPage::size * 2, false, | 199 UniscribeHelperTextRun state(buffer, GlyphPage::size * 2, false, |
200 fontData->m_font.hfont(), | 200 fontData->m_font.hfont(), |
201 fontData->m_font.scriptCache(), | 201 fontData->m_font.scriptCache(), |
202 fontData->m_font.scriptFontProperties()); | 202 fontData->m_font.scriptFontProperties()); |
203 state.set_inhibit_ligate(true); | 203 state.setInhibitLigate(true); |
204 state.Init(); | 204 state.Init(); |
205 | 205 |
206 for (unsigned i = 0; i < GlyphPage::size; i++) { | 206 for (unsigned i = 0; i < GlyphPage::size; i++) { |
207 WORD glyph = state.FirstGlyphForCharacter(i); | 207 WORD glyph = state.FirstGlyphForCharacter(i); |
208 if (glyph) { | 208 if (glyph) { |
209 have_glyphs = true; | 209 have_glyphs = true; |
210 page->setGlyphDataForIndex(i, glyph, fontData); | 210 page->setGlyphDataForIndex(i, glyph, fontData); |
211 } else { | 211 } else { |
212 // Clear both glyph and fontData fields. | 212 // Clear both glyph and fontData fields. |
213 page->setGlyphDataForIndex(i, 0, 0); | 213 page->setGlyphDataForIndex(i, 0, 0); |
(...skipping 17 matching lines...) Expand all Loading... |
231 return FillBMPGlyphs(characterBuffer, this, fontData, true); | 231 return FillBMPGlyphs(characterBuffer, this, fontData, true); |
232 } else if (bufferLength == GlyphPage::size * 2) { | 232 } else if (bufferLength == GlyphPage::size * 2) { |
233 return FillNonBMPGlyphs(characterBuffer, this, fontData); | 233 return FillNonBMPGlyphs(characterBuffer, this, fontData); |
234 } else { | 234 } else { |
235 // TODO: http://b/1007391 make use of offset and length | 235 // TODO: http://b/1007391 make use of offset and length |
236 return false; | 236 return false; |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 } | 240 } |
OLD | NEW |