2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/devel-api/text-abstraction/text-renderer-layout-helper.h>
25 #include <dali/devel-api/text-abstraction/font-client.h>
30 namespace TextAbstraction
33 void TransformToArc( const CircularTextParameters& parameters, double& x, double& y )
37 // Does the italic synthesization for circular layout.
38 if( parameters.synthesizeItalic )
40 const double xP = -yP * sin( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE );
41 yP *= cos( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE );
47 double radius = parameters.radius;
49 // Transform to a circular layout.
50 if( parameters.isClockwise )
52 angle = parameters.beginAngle - parameters.invRadius * x;
55 x = radius * cos( angle );
56 y = -radius * sin( angle );
60 angle = parameters.beginAngle + parameters.invRadius * x;
63 x = radius * cos( angle );
64 y = radius * sin( -angle );
67 // Transforms to the text area coordinate system.
68 x += parameters.centerX;
69 y += parameters.centerY;
72 } // namespace TextAbstraction