X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=blobdiff_plain;f=dali%2Fdevel-api%2Ftext-abstraction%2Ftext-renderer-layout-helper.cpp;h=5e17f9f62dd3b7fe25e738f561b68f8fbf232d03;hp=b5a3eb4d82fc2424ad71d4be382786057f056309;hb=20a7c6fb7964e0f4a2695a37615cebcfd05c34ea;hpb=b7c45bdf0893f8797006ff5002837ebd39106d02 diff --git a/dali/devel-api/text-abstraction/text-renderer-layout-helper.cpp b/dali/devel-api/text-abstraction/text-renderer-layout-helper.cpp index b5a3eb4..5e17f9f 100755 --- a/dali/devel-api/text-abstraction/text-renderer-layout-helper.cpp +++ b/dali/devel-api/text-abstraction/text-renderer-layout-helper.cpp @@ -21,38 +21,50 @@ // EXTERNAL INCLUDES #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace TextAbstraction { -void TransformToArcClockwise( const CircularTextParameters& parameters, double& x, double& y ) +void TransformToArc( const CircularTextParameters& parameters, double& x, double& y ) { - double radius = parameters.radius; - double angle = parameters.beginAngle; + double yP = y; - angle -= parameters.invRadius * x; + // Does the italic synthesization for circular layout. + if( parameters.synthesizeItalic ) + { + const double xP = -yP * sin( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE ); + yP *= cos( TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE ); - radius -= y; - x = radius * cos( angle ); - y = -radius * sin( angle ); - - x += parameters.centerX; - y += parameters.centerY; -} + x += xP; + } -void TransformToArcAntiClockwise( const CircularTextParameters& parameters, double& x, double& y ) -{ + double angle = 0.0; double radius = parameters.radius; - double angle = parameters.beginAngle; - angle += parameters.invRadius * x; + // Transform to a circular layout. + if( parameters.isClockwise ) + { + angle = parameters.beginAngle - parameters.invRadius * x; + radius -= yP; + + x = radius * cos( angle ); + y = -radius * sin( angle ); + } + else + { + angle = parameters.beginAngle + parameters.invRadius * x; + radius += yP; - radius += y; - x = radius * cos( angle ); - y = radius * sin( -angle ); + x = radius * cos( angle ); + y = radius * sin( -angle ); + } + // Transforms to the text area coordinate system. x += parameters.centerX; y += parameters.centerY; }