2 * Copyright (c) 2015 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-toolkit/internal/text/rendering/text-backend-impl.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/devel-api/adaptor-framework/singleton-service.h>
26 #include <dali-toolkit/public-api/text/rendering-backend.h>
27 #include <dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.h>
28 #ifdef ENABLE_VECTOR_BASED_TEXT_RENDERING
29 #include <dali-toolkit/internal/text/rendering/vector-based/vector-based-renderer.h>
46 int temp; // placeholder for future backend implemenations
60 Dali::Toolkit::Text::Backend Backend::Get()
62 Dali::Toolkit::Text::Backend backendHandle;
64 Dali::SingletonService service( SingletonService::Get() );
67 // Check whether the singleton is already created
68 Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Toolkit::Text::Backend ) );
71 // If so, downcast the handle
72 Backend* impl = dynamic_cast< Dali::Toolkit::Text::Internal::Backend* >( handle.GetObjectPtr() );
73 backendHandle = Dali::Toolkit::Text::Backend( impl );
75 else // create and register the object
77 backendHandle = Dali::Toolkit::Text::Backend( new Backend );
78 service.Register( typeid( backendHandle ), backendHandle );
85 RendererPtr Backend::NewRenderer( unsigned int renderingType )
89 switch( renderingType )
91 case Dali::Toolkit::Text::RENDERING_SHARED_ATLAS:
93 renderer = Dali::Toolkit::Text::AtlasRenderer::New();
97 case Dali::Toolkit::Text::RENDERING_VECTOR_BASED:
99 #ifdef ENABLE_VECTOR_BASED_TEXT_RENDERING
100 renderer = Dali::Toolkit::Text::VectorBasedRenderer::New();
102 renderer = Dali::Toolkit::Text::AtlasRenderer::New(); // Fallback to bitmap-based rendering
109 DALI_LOG_WARNING( "Unknown renderer type: %d\n", renderingType );
117 } // namespace Internal
121 } // namespace Toolkit