Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: Source/core/platform/graphics/Font.h

Issue 18332019: Allow fractional letter- word-spacing values. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: *actually* add the file Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Holger Hans Peter Freyther 6 * Copyright (C) 2008 Holger Hans Peter Freyther
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 int right; 72 int right;
73 int top; 73 int top;
74 int bottom; 74 int bottom;
75 bool computeBounds; 75 bool computeBounds;
76 }; 76 };
77 77
78 78
79 class Font { 79 class Font {
80 public: 80 public:
81 Font(); 81 Font();
82 Font(const FontDescription&, short letterSpacing, short wordSpacing); 82 Font(const FontDescription&, float letterSpacing, float wordSpacing);
83 // This constructor is only used if the platform wants to start with a nativ e font. 83 // This constructor is only used if the platform wants to start with a nativ e font.
84 Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoot hing); 84 Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoot hing);
85 ~Font(); 85 ~Font();
86 86
87 Font(const Font&); 87 Font(const Font&);
88 Font& operator=(const Font&); 88 Font& operator=(const Font&);
89 89
90 bool operator==(const Font& other) const; 90 bool operator==(const Font& other) const;
91 bool operator!=(const Font& other) const { return !(*this == other); } 91 bool operator!=(const Font& other) const { return !(*this == other); }
92 92
(...skipping 13 matching lines...) Expand all
106 106
107 PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWh iteSpace) const; 107 PassOwnPtr<TextLayout> createLayout(RenderText*, float xPos, bool collapseWh iteSpace) const;
108 static void deleteLayout(TextLayout*); 108 static void deleteLayout(TextLayout*);
109 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const S impleFontData*>* fallbackFonts = 0); 109 static float width(TextLayout&, unsigned from, unsigned len, HashSet<const S impleFontData*>* fallbackFonts = 0);
110 110
111 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const; 111 int offsetForPosition(const TextRun&, float position, bool includePartialGly phs) const;
112 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const; 112 FloatRect selectionRectForText(const TextRun&, const FloatPoint&, int h, int from = 0, int to = -1) const;
113 113
114 bool isSmallCaps() const { return m_fontDescription.smallCaps(); } 114 bool isSmallCaps() const { return m_fontDescription.smallCaps(); }
115 115
116 short wordSpacing() const { return m_wordSpacing; } 116 float wordSpacing() const { return m_wordSpacing; }
117 short letterSpacing() const { return m_letterSpacing; } 117 float letterSpacing() const { return m_letterSpacing; }
118 void setWordSpacing(short s) { m_wordSpacing = s; } 118 void setWordSpacing(float s) { m_wordSpacing = s; }
119 void setLetterSpacing(short s) { m_letterSpacing = s; } 119 void setLetterSpacing(float s) { m_letterSpacing = s; }
120 bool isFixedPitch() const; 120 bool isFixedPitch() const;
121 bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); } 121 bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
122 122
123 FontRenderingMode renderingMode() const { return m_fontDescription.rendering Mode(); } 123 FontRenderingMode renderingMode() const { return m_fontDescription.rendering Mode(); }
124 124
125 TypesettingFeatures typesettingFeatures() const { return m_typesettingFeatur es; } 125 TypesettingFeatures typesettingFeatures() const { return m_typesettingFeatur es; }
126 126
127 FontFamily& firstFamily() { return m_fontDescription.firstFamily(); } 127 FontFamily& firstFamily() { return m_fontDescription.firstFamily(); }
128 const FontFamily& family() const { return m_fontDescription.family(); } 128 const FontFamily& family() const { return m_fontDescription.family(); }
129 129
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 break; 282 break;
283 } 283 }
284 284
285 return features; 285 return features;
286 } 286 }
287 287
288 static TypesettingFeatures s_defaultTypesettingFeatures; 288 static TypesettingFeatures s_defaultTypesettingFeatures;
289 289
290 FontDescription m_fontDescription; 290 FontDescription m_fontDescription;
291 mutable RefPtr<FontFallbackList> m_fontFallbackList; 291 mutable RefPtr<FontFallbackList> m_fontFallbackList;
292 short m_letterSpacing; 292 float m_letterSpacing;
293 short m_wordSpacing; 293 float m_wordSpacing;
294 bool m_isPlatformFont; 294 bool m_isPlatformFont;
295 bool m_needsTranscoding; 295 bool m_needsTranscoding;
296 mutable TypesettingFeatures m_typesettingFeatures; // Caches values computed from m_fontDescription. 296 mutable TypesettingFeatures m_typesettingFeatures; // Caches values computed from m_fontDescription.
297 }; 297 };
298 298
299 inline Font::~Font() 299 inline Font::~Font()
300 { 300 {
301 } 301 }
302 302
303 inline const SimpleFontData* Font::primaryFont() const 303 inline const SimpleFontData* Font::primaryFont() const
(...skipping 29 matching lines...) Expand all
333 333
334 } 334 }
335 335
336 namespace WTF { 336 namespace WTF {
337 337
338 template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*); 338 template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*);
339 339
340 } 340 }
341 341
342 #endif 342 #endif
OLDNEW
« no previous file with comments | « Source/core/page/animation/CSSPropertyAnimation.cpp ('k') | Source/core/platform/graphics/Font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698