1 #ifndef __DALI_INTERNAL_FONT_LAYOUT_H__
2 #define __DALI_INTERNAL_FONT_LAYOUT_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/integration-api/glyph-set.h>
24 #include <dali/public-api/math/vector2.h>
33 * Structure contains the information required to layout text.
34 * Contains the fonts global metrics, DPI, pad adjust and units per EM.
35 * All members are POD.
37 * Font-Metrics class will create and and own this struct.
38 * Text-Metric objects will hold a read only pointer to this struct.
50 * @param unitsPerEM units per EM
51 * @param dpi dots per inch
53 FontLayout( float unitsPerEM, Vector2 dpi );
56 * Set the global metrics
57 * @param metrics dali integration global metric object
59 void SetMetrics( const Dali::Integration::GlobalMetrics &metrics );
62 * Returns the global metrics
63 * @return global metrics
65 const Dali::Integration::GlobalMetrics& GetGlobalMetrics() const;
68 * Get a multiplier value to scale measurements to pixels based on the given pointSize
69 * @param[in] pointSize The pointSize
70 * @return A multiplier value to scale measurements to pixels
72 float GetUnitsToPixels( const float pointSize ) const;
75 * The line height is the vertical distance between the top of the highest character
76 * to the bottom of the lowest character
77 * @return the line height of the font in pixels
79 float GetLineHeight() const;
82 * The ascender is the vertical distance from the
83 * baseline to the highest character coordinate in a font face.
84 * @return the ascender in pixels
86 float GetAscender() const;
89 * Returns the underline position for this font.
90 * @return The underline position.
92 float GetUnderlinePosition() const;
95 * Returns the thickness of the underline for this font.
96 * @return The thickness of the underline.
98 float GetUnderlineThickness() const;
101 * Return the units per em for this font.
102 * @return units per em
104 float GetUnitsPerEM() const;
107 * Returns the width of the widest glyph in this font in font units
108 * @return Width of widest glyph
110 float GetMaxWidth() const;
113 * Returns the height of the tallest glyph in this font in font units
114 * @return Hight of tallest glyph
116 float GetMaxHeight() const;
119 * Returns the horizontal pad adjust for this font in font units
120 * @return Horizontal pad adjust
122 float GetPadAdjustX() const;
125 * Returns the vertical pad adjust for this font in font units
126 * @return Vertical pad adjust
128 float GetPadAdjustY() const;
131 * Returns the dots per inch for this font
134 Vector2 GetDpi() const;
139 Dali::Integration::GlobalMetrics mMetrics; ///< integration Metrics
140 float mUnitsPerEM; ///< Font units/EM. Used to convert from units to pixels. Equal to (1.0f / GlobalMetrics.unitsPerEm)
141 Vector2 mDpi; ///< Dots per inch. Used to convert from units to pixels.
144 } // namespace Internal
148 #endif // __DALI_INTERNAL_FONT_LAYOUT_H__