Italic synthesize for circular layout.
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / text-abstraction / text-renderer-layout-helper.h
1 #ifndef DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H
2 #define DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/dali-adaptor-common.h>
24
25 namespace Dali
26 {
27
28 namespace TextAbstraction
29 {
30
31 /**
32  * @brief Parameters used to transform the vertices of the glyphs to wrap a circular path.
33  */
34 struct DALI_ADAPTOR_API CircularTextParameters
35 {
36   CircularTextParameters()
37   : centerX{ 0.0 },
38     centerY{ 0.0 },
39     radius{ 0.0 },
40     invRadius{ 0.0 },
41     beginAngle{ 0.0 },
42     isClockwise{ true },
43     synthesizeItalic{ false }
44   {}
45
46   double centerX;          ///< The 'x' center of the circular path.
47   double centerY;          ///< The 'y' center of the circular path.
48   double radius;           ///< The radius in pixels.
49   double invRadius;        ///< 1.0 / radius.
50   double beginAngle;       ///< The angle in radians where the circular text begins.
51   bool isClockwise:1;      ///< Whether the circular text layout is clockwise.
52   bool synthesizeItalic:1; ///< Whether to synthesize italic.
53 };
54
55 /**
56  * @brief Transforms a vertex to wrap a circular path.
57  *
58  * @param[in] parameters The parameters of the circular path.
59  * @param[in,out] x The 'x' coordinate of the vertex.
60  * @param[in,out] y The 'y' coordinate of the vertex.
61  */
62 DALI_ADAPTOR_API void TransformToArc( const CircularTextParameters& parameters, double& x, double& y );
63
64 } // namespace TextAbstraction
65
66 } // namespace Dali
67
68 #endif // DALI_PLATFORM_TEXT_ABSTRACTION_TEXT_RENDERER_LAYOUT_HELPER_H