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

Side by Side Diff: Source/core/html/TextMetrics.h

Issue 141433026: Font metrics, version 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding Layout tests. Should work for simple text. Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 32
33 namespace WebCore { 33 namespace WebCore {
34 34
35 class TextMetrics : public RefCounted<TextMetrics>, public ScriptWrappable { 35 class TextMetrics : public RefCounted<TextMetrics>, public ScriptWrappable {
36 public: 36 public:
37 static PassRefPtr<TextMetrics> create() { return adoptRef(new TextMetrics); } 37 static PassRefPtr<TextMetrics> create() { return adoptRef(new TextMetrics); }
38 38
39 float width() const { return m_width; } 39 float width() const { return m_width; }
40 void setWidth(float w) { m_width = w; } 40 void setWidth(float w) { m_width = w; }
41 41
42 float actualBoundingBoxLeft() const { return m_actualBoundingBoxLeft; }
eseidel 2014/01/31 22:03:31 So strange. Don't we have a more sophisitcated ob
43 void setActualBoundingBoxLeft(float abbl) { m_actualBoundingBoxLeft = abbl; }
44
45 float actualBoundingBoxRight() const { return m_actualBoundingBoxRight; }
46 void setActualBoundingBoxRight(float abbr) { m_actualBoundingBoxRight = abbr ; }
47
48 float fontBoundingBoxAscent() const { return m_fontBoundingBoxAscent; }
49 void setFontBoundingBoxAscent(float fbba) { m_fontBoundingBoxAscent = fbba; }
50
51 float fontBoundingBoxDescent() const { return m_fontBoundingBoxDescent; }
52 void setFontBoundingBoxDescent(float fbbd) { m_fontBoundingBoxDescent = fbbd ; }
53
54 float actualBoundingBoxAscent() const { return m_actualBoundingBoxAscent; }
55 void setActualBoundingBoxAscent(float abba) { m_actualBoundingBoxAscent = ab ba; }
56
57 float actualBoundingBoxDescent() const { return m_actualBoundingBoxDescent; }
58 void setActualBoundingBoxDescent(float abbd) { m_actualBoundingBoxDescent = abbd; }
59
60 float emHeightAscent() const { return m_emHeightAscent; }
61 void setEmHeightAscent(float eha) { m_emHeightAscent = eha; }
62
63 float emHeightDescent() const { return m_emHeightDescent; }
64 void setEmHeightDescent(float ehd) { m_emHeightDescent = ehd; }
65
66 float hangingBaseline() const { return m_hangingBaseline; }
67 void setHangingBaseline(float hb) { m_hangingBaseline = hb; }
68
69 float alphabeticBaseline() const { return m_alphabeticBaseline; }
70 void setAlphabeticBaseline(float ab) { m_alphabeticBaseline = ab; }
71
72 float ideographicBaseline() const { return m_ideographicBaseline; }
73 void setIdeographicBaseline(float ib) { m_ideographicBaseline = ib; }
74
42 private: 75 private:
43 TextMetrics() 76 TextMetrics()
44 : m_width(0) 77 : m_width(0)
78 , m_actualBoundingBoxLeft(0)
79 , m_actualBoundingBoxRight(0)
80 , m_fontBoundingBoxAscent(0)
81 , m_fontBoundingBoxDescent(0)
82 , m_actualBoundingBoxAscent(0)
83 , m_actualBoundingBoxDescent(0)
84 , m_emHeightAscent(0)
85 , m_emHeightDescent(0)
86 , m_hangingBaseline(0)
87 , m_alphabeticBaseline(0)
88 , m_ideographicBaseline(0)
45 { 89 {
46 ScriptWrappable::init(this); 90 ScriptWrappable::init(this);
47 } 91 }
48 92
93 // x-direction
49 float m_width; 94 float m_width;
95 float m_actualBoundingBoxLeft;
96 float m_actualBoundingBoxRight;
97
98 // y-direction
99 float m_fontBoundingBoxAscent;
100 float m_fontBoundingBoxDescent;
101 float m_actualBoundingBoxAscent;
102 float m_actualBoundingBoxDescent;
103 float m_emHeightAscent;
104 float m_emHeightDescent;
105 float m_hangingBaseline;
106 float m_alphabeticBaseline;
107 float m_ideographicBaseline;
50 }; 108 };
51 109
52 } // namespace WebCore 110 } // namespace WebCore
53 111
54 #endif // TextMetrics_h 112 #endif // TextMetrics_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698