OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2003, 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
4 * Copyright (C) 2009 Torch Mobile, Inc. | 4 * Copyright (C) 2009 Torch Mobile, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 variant = BrokenIdeographVariant; | 286 variant = BrokenIdeographVariant; |
287 if (variant != NormalVariant) | 287 if (variant != NormalVariant) |
288 characterFontData = characterFontData->variantFontData(m_fontDescrip
tion, variant); | 288 characterFontData = characterFontData->variantFontData(m_fontDescrip
tion, variant); |
289 } | 289 } |
290 if (characterFontData) { | 290 if (characterFontData) { |
291 // Got the fallback glyph and font. | 291 // Got the fallback glyph and font. |
292 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontD
ata.get(), pageNumber)->page(); | 292 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontD
ata.get(), pageNumber)->page(); |
293 GlyphData data = fallbackPage && fallbackPage->fontDataForCharacter(c) ?
fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData(); | 293 GlyphData data = fallbackPage && fallbackPage->fontDataForCharacter(c) ?
fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData(); |
294 // Cache it so we don't have to do system fallback again next time. | 294 // Cache it so we don't have to do system fallback again next time. |
295 if (variant == NormalVariant) { | 295 if (variant == NormalVariant) { |
296 #if OS(WINCE) | |
297 // missingGlyphData returns a null character, which is not suitable
for GDI to display. | |
298 // Also, sometimes we cannot map a font for the character on WINCE,
but GDI can still | |
299 // display the character, probably because the font package is not i
nstalled correctly. | |
300 // So we just always set the glyph to be same as the character, and
let GDI solve it. | |
301 page->setGlyphDataForCharacter(c, c, characterFontData.get()); | |
302 characterFontData->setMaxGlyphPageTreeLevel(max(characterFontData->m
axGlyphPageTreeLevel(), node->level())); | |
303 return make_pair(page->glyphDataForCharacter(c), page); | |
304 #else | |
305 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 296 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
306 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphP
ageTreeLevel(), node->level())); | 297 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphP
ageTreeLevel(), node->level())); |
307 if (!isCJKIdeographOrSymbol(c) && data.fontData->platformData().orie
ntation() != Horizontal && !data.fontData->isTextOrientationFallback()) | 298 if (!isCJKIdeographOrSymbol(c) && data.fontData->platformData().orie
ntation() != Horizontal && !data.fontData->isTextOrientationFallback()) |
308 return glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(c,
m_fontDescription.nonCJKGlyphOrientation(), data, fallbackPage, pageNumber); | 299 return glyphDataAndPageForNonCJKCharacterWithGlyphOrientation(c,
m_fontDescription.nonCJKGlyphOrientation(), data, fallbackPage, pageNumber); |
309 #endif | |
310 } | 300 } |
311 return make_pair(data, page); | 301 return make_pair(data, page); |
312 } | 302 } |
313 | 303 |
314 // Even system fallback can fail; use the missing glyph in that case. | 304 // Even system fallback can fail; use the missing glyph in that case. |
315 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. | 305 // FIXME: It would be nicer to use the missing glyph from the last resort fo
nt instead. |
316 GlyphData data = primaryFont()->missingGlyphData(); | 306 GlyphData data = primaryFont()->missingGlyphData(); |
317 if (variant == NormalVariant) { | 307 if (variant == NormalVariant) { |
318 #if OS(WINCE) | |
319 // See comment about WINCE GDI handling near setGlyphDataForCharacter ab
ove. | |
320 page->setGlyphDataForCharacter(c, c, data.fontData); | |
321 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphPageT
reeLevel(), node->level())); | |
322 return make_pair(page->glyphDataForCharacter(c), page); | |
323 #else | |
324 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); | 308 page->setGlyphDataForCharacter(c, data.glyph, data.fontData); |
325 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphPageT
reeLevel(), node->level())); | 309 data.fontData->setMaxGlyphPageTreeLevel(max(data.fontData->maxGlyphPageT
reeLevel(), node->level())); |
326 #endif | |
327 } | 310 } |
328 return make_pair(data, page); | 311 return make_pair(data, page); |
329 } | 312 } |
330 | 313 |
331 bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const | 314 bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const |
332 { | 315 { |
333 unsigned pageNumber = (character / GlyphPage::size); | 316 unsigned pageNumber = (character / GlyphPage::size); |
334 | 317 |
335 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(primaryFont(), pag
eNumber); | 318 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(primaryFont(), pag
eNumber); |
336 GlyphPage* page = node->page(); | 319 GlyphPage* page = node->page(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (delta <= 0) | 614 if (delta <= 0) |
632 break; | 615 break; |
633 } | 616 } |
634 } | 617 } |
635 } | 618 } |
636 | 619 |
637 return offset; | 620 return offset; |
638 } | 621 } |
639 | 622 |
640 } | 623 } |
OLD | NEW |