~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/svg/SVGFontData.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 */
 
19
 
 
20
#ifndef SVGFontData_h
 
21
#define SVGFontData_h
 
22
 
 
23
#if ENABLE(SVG_FONTS)
 
24
#include "SimpleFontData.h"
 
25
#include "SVGFontFaceElement.h"
 
26
 
 
27
namespace WebCore {
 
28
 
 
29
class SVGFontData : public SimpleFontData::AdditionalFontData {
 
30
public:
 
31
    static PassOwnPtr<SVGFontData> create(SVGFontFaceElement* element)
 
32
    {
 
33
        return adoptPtr(new SVGFontData(element));
 
34
    }
 
35
 
 
36
    virtual ~SVGFontData() { }
 
37
 
 
38
    virtual void initializeFontData(SimpleFontData*, float fontSize);
 
39
    virtual float widthForSVGGlyph(Glyph, float fontSize) const;
 
40
    virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const;
 
41
    virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength) const;
 
42
 
 
43
    SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
 
44
 
 
45
    float horizontalOriginX() const { return m_horizontalOriginX; }
 
46
    float horizontalOriginY() const { return m_horizontalOriginY; }
 
47
    float horizontalAdvanceX() const { return m_horizontalAdvanceX; }
 
48
 
 
49
    float verticalOriginX() const { return m_verticalOriginX; }
 
50
    float verticalOriginY() const { return m_verticalOriginY; }
 
51
    float verticalAdvanceY() const { return m_verticalAdvanceY; }
 
52
 
 
53
private:
 
54
    SVGFontData(SVGFontFaceElement*);
 
55
 
 
56
    bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;
 
57
    bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const;
 
58
 
 
59
    String createStringWithMirroredCharacters(const UChar* characters, unsigned length) const;
 
60
 
 
61
    // Ths SVGFontFaceElement is kept alive --
 
62
    // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document
 
63
    //    containing the element;
 
64
    // 2) in the in-document font case: by virtue of being in the document tree and making sure that when it is removed
 
65
    //    from the document, it removes the @font-face rule it owns from the document's mapped element sheet and forces
 
66
    //    a style update.
 
67
    SVGFontFaceElement* m_svgFontFaceElement;
 
68
 
 
69
    float m_horizontalOriginX;
 
70
    float m_horizontalOriginY;
 
71
    float m_horizontalAdvanceX;
 
72
 
 
73
    float m_verticalOriginX;
 
74
    float m_verticalOriginY;
 
75
    float m_verticalAdvanceY;
 
76
};
 
77
 
 
78
} // namespace WebCore
 
79
 
 
80
#endif
 
81
#endif // SVGFontData_h