| 1 | /* |
| 2 | * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include <wtf/Ref.h> |
| 29 | #include <wtf/RefCounted.h> |
| 30 | |
| 31 | namespace WebCore { |
| 32 | |
| 33 | class TextMetrics : public RefCounted<TextMetrics> { |
| 34 | public: |
| 35 | static Ref<TextMetrics> create() { return adoptRef(*new TextMetrics); } |
| 36 | |
| 37 | float width() const { return m_width; } |
| 38 | void setWidth(float w) { m_width = w; } |
| 39 | |
| 40 | float actualBoundingBoxLeft() const { return m_actualBoundingBoxLeft; } |
| 41 | void setActualBoundingBoxLeft(float value) { m_actualBoundingBoxLeft = value; } |
| 42 | |
| 43 | float actualBoundingBoxRight() const { return m_actualBoundingBoxRight; } |
| 44 | void setActualBoundingBoxRight(float value) { m_actualBoundingBoxRight = value; } |
| 45 | |
| 46 | float fontBoundingBoxAscent() const { return m_fontBoundingBoxAscent; } |
| 47 | void setFontBoundingBoxAscent(float value) { m_fontBoundingBoxAscent = value; } |
| 48 | |
| 49 | float fontBoundingBoxDescent() const { return m_fontBoundingBoxDescent; } |
| 50 | void setFontBoundingBoxDescent(float value) { m_fontBoundingBoxDescent = value; } |
| 51 | |
| 52 | float actualBoundingBoxAscent() const { return m_actualBoundingBoxAscent; } |
| 53 | void setActualBoundingBoxAscent(float value) { m_actualBoundingBoxAscent = value; } |
| 54 | |
| 55 | float actualBoundingBoxDescent() const { return m_actualBoundingBoxDescent; } |
| 56 | void setActualBoundingBoxDescent(float value) { m_actualBoundingBoxDescent = value; } |
| 57 | |
| 58 | float emHeightAscent() const { return m_emHeightAscent; } |
| 59 | void setEmHeightAscent(float value) { m_emHeightAscent = value; } |
| 60 | |
| 61 | float emHeightDescent() const { return m_emHeightDescent; } |
| 62 | void setEmHeightDescent(float value) { m_emHeightDescent = value; } |
| 63 | |
| 64 | float hangingBaseline() const { return m_hangingBaseline; } |
| 65 | void setHangingBaseline(float value) { m_hangingBaseline = value; } |
| 66 | |
| 67 | float alphabeticBaseline() const { return m_alphabeticBaseline; } |
| 68 | void setAlphabeticBaseline(float value) { m_alphabeticBaseline = value; } |
| 69 | |
| 70 | float ideographicBaseline() const { return m_ideographicBaseline; } |
| 71 | void setIdeographicBaseline(float value) { m_ideographicBaseline = value; } |
| 72 | |
| 73 | private: |
| 74 | float m_width { 0 }; |
| 75 | float m_actualBoundingBoxLeft { 0 }; |
| 76 | float m_actualBoundingBoxRight { 0 }; |
| 77 | float m_fontBoundingBoxAscent { 0 }; |
| 78 | float m_fontBoundingBoxDescent { 0 }; |
| 79 | float m_actualBoundingBoxAscent { 0 }; |
| 80 | float m_actualBoundingBoxDescent { 0 }; |
| 81 | float m_emHeightAscent { 0 }; |
| 82 | float m_emHeightDescent { 0 }; |
| 83 | float m_hangingBaseline { 0 }; |
| 84 | float m_alphabeticBaseline { 0 }; |
| 85 | float m_ideographicBaseline { 0 }; |
| 86 | }; |
| 87 | |
| 88 | } // namespace WebCore |
| 89 | |