1 #ifndef __DALI_FONT_METRICS_INTERFACE_H__
2 #define __DALI_FONT_METRICS_INTERFACE_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.
22 #include <dali/internal/event/text/resource/font-id.h>
23 #include <dali/internal/event/text/glyph-metric.h>
24 #include <dali/integration-api/text-array.h>
37 * Abstract interface for requesting information about a font and its metrics.
40 class FontMetricsInterface
46 * Ensures the metrics for each character in the text are loaded and cached.
47 * @param[in] text The text string to load the metrics for.
49 virtual void LoadMetricsSynchronously( const Integration::TextArray& text ) = 0;
52 * Gets the metrics for a single character.
53 * The glyph information holds the character dimensions and layout information.
54 * @note LoadMetricsSynchronously() should be called on the string you wish
55 * to get the metrics for, before calling GetGlyph() on each character
56 * @param[in] charIndex character code
57 * @return pointer to a glyph metric object
59 virtual const GlyphMetric* GetGlyph( uint32_t charIndex ) const = 0;
62 * Get the unique id for the font.
65 virtual FontId GetFontId() const = 0;
69 * @return the font family name
71 virtual const std::string& GetFontFamilyName() const = 0;
75 * @return the font style name
77 virtual const std::string& GetFontStyleName() const = 0;
80 * Get the maximum glyph size.
81 * @param[out] width maximum width of a character in the font
82 * @param[out] height maximum height of a character in the font
84 virtual void GetMaximumGylphSize(float& width, float& height) const = 0;
87 * Get a multiplier value to scale measurements to pixels based on the given pointSize
88 * @param[in] pointSize The pointSize
89 * @return A multiplier value to scale measurements to pixels
91 virtual float GetUnitsToPixels(const float pointSize) const = 0;
94 * The line height is the vertical distance between the top of the highest character
95 * to the bottom of the lowest character
96 * @return the line height of the font in pixels
98 virtual float GetLineHeight() const = 0;
101 * The ascender is the vertical distance from the
102 * baseline to the highest character coordinate in a font face.
103 * @return the ascender in pixels
105 virtual float GetAscender() const = 0;
108 * Returns the underline position for this font.
109 * @return The underline position.
111 virtual float GetUnderlinePosition() const = 0;
114 * Returns the thickness of the underline for this font.
115 * @return The thickness of the underline.
117 virtual float GetUnderlineThickness() const = 0;
120 * Returns the width of the widest glyph in this font in pixels
121 * @return Width of widest glyph
123 virtual float GetMaxWidth() const = 0;
126 * Returns the height of the tallest glyph in this font in pixels
127 * @return Height of tallest glyph
129 virtual float GetMaxHeight() const = 0;
132 * Returns the horizontal pad adjust for this font in pixels
133 * @return Horizontal pad adjust
135 virtual float GetPadAdjustX() const = 0;
138 * Returns the vertical pad adjust for this font in pixels
139 * @return Vertical pad adjust
141 virtual float GetPadAdjustY() const = 0;
149 FontMetricsInterface()
156 virtual ~FontMetricsInterface()
160 // Undefined copy constructor.
161 FontMetricsInterface( const FontMetricsInterface& );
163 // Undefined assignment operator.
164 FontMetricsInterface& operator=( const FontMetricsInterface& );
169 } // namespace Internal
173 #endif // __DALI_FONT_METRICS_INTERFACE_H__