2 * Copyright (C) 2007-2009 Torch Mobile Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
22 #include "GlyphPageTreeNode.h"
25 #include "FontCache.h"
27 #include "SimpleFontData.h"
31 DWORD getKnownFontCodePages(const wchar_t* family);
33 typedef unsigned (*funcGetCharCodePages)(unsigned short c, unsigned& lastPos);
34 funcGetCharCodePages getCharCodePages = 0;
36 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
38 if (length != bufferLength)
41 if (fontData->platformData().hfont()) {
42 DWORD fontCodePages = fontData->platformData().codePages();
44 if (getCharCodePages) {
46 for (unsigned i = 0; i < bufferLength; ++i) {
47 DWORD actualCodePages = getCharCodePages(buffer[i], lastPos);
48 if (!actualCodePages || (actualCodePages & fontCodePages))
49 setGlyphDataForIndex(offset + i, buffer[i], fontData);
51 setGlyphDataForIndex(offset + i, buffer[i], 0);
54 #if defined(IMLANG_FONT_LINK) && (IMLANG_FONT_LINK == 2)
55 } else if (IMLangFontLink2* langFontLink = fontCache()->getFontLinkInterface()) {
57 } else if (IMLangFontLink* langFontLink = fontCache()->getFontLinkInterface()) {
59 for (unsigned i = 0; i < bufferLength; ++i) {
60 DWORD actualCodePages;
61 langFontLink->GetCharCodePages(buffer[i], &actualCodePages);
62 if (!actualCodePages || (actualCodePages & fontCodePages))
63 setGlyphDataForIndex(offset + i, buffer[i], fontData);
65 setGlyphDataForIndex(offset + i, buffer[i], 0);
72 for (unsigned i = 0; i < length; ++i)
73 setGlyphDataForIndex(offset + i, buffer[i], fontData);
78 } // namespace WebCore