2 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
3 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
4 * Copyright (C) 2006 George Staikos <staikos@kde.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include "FloatRect.h"
38 #include "FontCache.h"
39 #include "GlyphBuffer.h"
40 #include "FontDescription.h"
42 #include <QFontMetrics>
46 void FontData::platformInit()
48 QFontMetrics metrics(m_font.font());
49 m_ascent = metrics.ascent();
50 m_descent = metrics.descent();
51 m_lineSpacing = metrics.lineSpacing();
52 m_lineGap = metrics.leading();
53 m_xHeight = metrics.xHeight();
54 m_lineSpacing = m_ascent + m_descent + m_lineGap;
57 void FontData::platformDestroy()
61 FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
66 bool FontData::containsCharacters(const UChar* characters, int length) const
71 void FontData::determinePitch()
75 float FontData::platformWidthForGlyph(Glyph glyph) const
77 return QFontMetricsF(m_font.font()).width(QChar(ushort(glyph)));