15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008 Apple Inc. All Rights Reserved. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met: 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2302772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef TextMetrics_h 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define TextMetrics_h 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 29197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ScriptWrappable.h" 30c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)#include "platform/heap/Handle.h" 3193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "wtf/PassRefPtr.h" 3293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "wtf/RefCounted.h" 335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 34c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 36c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)class TextMetrics FINAL : public RefCountedWillBeGarbageCollected<TextMetrics>, public ScriptWrappable { 377242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci DEFINE_WRAPPERTYPEINFO(); 385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public: 39c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) static PassRefPtrWillBeRawPtr<TextMetrics> create() { return adoptRefWillBeNoop(new TextMetrics); } 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) float width() const { return m_width; } 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void setWidth(float w) { m_width = w; } 435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 44d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float actualBoundingBoxLeft() const { return m_actualBoundingBoxLeft; } 45d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setActualBoundingBoxLeft(float actualBoundingBoxLeft) { m_actualBoundingBoxLeft = actualBoundingBoxLeft; } 46d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 47d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float actualBoundingBoxRight() const { return m_actualBoundingBoxRight; } 48d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setActualBoundingBoxRight(float actualBoundingBoxRight) { m_actualBoundingBoxRight = actualBoundingBoxRight; } 49d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 50d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float fontBoundingBoxAscent() const { return m_fontBoundingBoxAscent; } 51d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setFontBoundingBoxAscent(float fontBoundingBoxAscent) { m_fontBoundingBoxAscent = fontBoundingBoxAscent; } 52d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 53d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float fontBoundingBoxDescent() const { return m_fontBoundingBoxDescent; } 54d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setFontBoundingBoxDescent(float fontBoundingBoxDescent) { m_fontBoundingBoxDescent = fontBoundingBoxDescent; } 55d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 56d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float actualBoundingBoxAscent() const { return m_actualBoundingBoxAscent; } 57d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setActualBoundingBoxAscent(float actualBoundingBoxAscent) { m_actualBoundingBoxAscent = actualBoundingBoxAscent; } 58d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 59d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float actualBoundingBoxDescent() const { return m_actualBoundingBoxDescent; } 60d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setActualBoundingBoxDescent(float actualBoundingBoxDescent) { m_actualBoundingBoxDescent = actualBoundingBoxDescent; } 61d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 62d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float emHeightAscent() const { return m_emHeightAscent; } 63d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setEmHeightAscent(float emHeightAscent) { m_emHeightAscent = emHeightAscent; } 64d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 65d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float emHeightDescent() const { return m_emHeightDescent; } 66d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setEmHeightDescent(float emHeightDescent) { m_emHeightDescent = emHeightDescent; } 67d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 68d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float hangingBaseline() const { return m_hangingBaseline; } 69d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setHangingBaseline(float hangingBaseline) { m_hangingBaseline = hangingBaseline; } 70d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 71d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float alphabeticBaseline() const { return m_alphabeticBaseline; } 72d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setAlphabeticBaseline(float alphabeticBaseline) { m_alphabeticBaseline = alphabeticBaseline; } 73d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 74d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float ideographicBaseline() const { return m_ideographicBaseline; } 75d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setIdeographicBaseline(float ideographicBaseline) { m_ideographicBaseline = ideographicBaseline; } 76d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 77c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) void trace(Visitor*) { } 78c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles) 795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private: 805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) TextMetrics() 815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) : m_width(0) 82d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_actualBoundingBoxLeft(0) 83d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_actualBoundingBoxRight(0) 84d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_fontBoundingBoxAscent(0) 85d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_fontBoundingBoxDescent(0) 86d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_actualBoundingBoxAscent(0) 87d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_actualBoundingBoxDescent(0) 88d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_emHeightAscent(0) 89d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_emHeightDescent(0) 90d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_hangingBaseline(0) 91d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) , m_alphabeticBaseline(0) 927242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci , m_ideographicBaseline(0) { } 935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 94d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) // x-direction 955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) float m_width; 96d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_actualBoundingBoxLeft; 97d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_actualBoundingBoxRight; 98d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 99d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) // y-direction 100d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_fontBoundingBoxAscent; 101d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_fontBoundingBoxDescent; 102d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_actualBoundingBoxAscent; 103d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_actualBoundingBoxDescent; 104d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_emHeightAscent; 105d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_emHeightDescent; 106d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_hangingBaseline; 107d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_alphabeticBaseline; 108d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float m_ideographicBaseline; 1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 111c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 1125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // TextMetrics_h 114