| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 bool have_glyphs = false; | 197 bool have_glyphs = false; |
| 198 | 198 |
| 199 UniscribeHelperTextRun 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.setInhibitLigate(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 // Each character in this input buffer is a surrogate pair, which |
| 208 // consists of two UChars. So, the offset for its i-th character is |
| 209 // (i * 2). |
| 210 WORD glyph = state.FirstGlyphForCharacter(i * 2); |
| 208 if (glyph) { | 211 if (glyph) { |
| 209 have_glyphs = true; | 212 have_glyphs = true; |
| 210 page->setGlyphDataForIndex(i, glyph, fontData); | 213 page->setGlyphDataForIndex(i, glyph, fontData); |
| 211 } else { | 214 } else { |
| 212 // Clear both glyph and fontData fields. | 215 // Clear both glyph and fontData fields. |
| 213 page->setGlyphDataForIndex(i, 0, 0); | 216 page->setGlyphDataForIndex(i, 0, 0); |
| 214 } | 217 } |
| 215 } | 218 } |
| 216 return have_glyphs; | 219 return have_glyphs; |
| 217 } | 220 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 231 return FillBMPGlyphs(characterBuffer, this, fontData, true); | 234 return FillBMPGlyphs(characterBuffer, this, fontData, true); |
| 232 } else if (bufferLength == GlyphPage::size * 2) { | 235 } else if (bufferLength == GlyphPage::size * 2) { |
| 233 return FillNonBMPGlyphs(characterBuffer, this, fontData); | 236 return FillNonBMPGlyphs(characterBuffer, this, fontData); |
| 234 } else { | 237 } else { |
| 235 // TODO: http://b/1007391 make use of offset and length | 238 // TODO: http://b/1007391 make use of offset and length |
| 236 return false; | 239 return false; |
| 237 } | 240 } |
| 238 } | 241 } |
| 239 | 242 |
| 240 } | 243 } |
| OLD | NEW |