1 #ifndef DALI_TOOLKIT_TEXT_TYPESETTER_H
2 #define DALI_TOOLKIT_TEXT_TYPESETTER_H
5 * Copyright (c) 2016 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/public-api/common/intrusive-ptr.h>
23 #include <dali/public-api/object/ref-object.h>
24 #include <dali/public-api/images/pixel-data.h>
39 typedef IntrusivePtr<Typesetter> TypesetterPtr;
42 * @brief This class is responsible of controlling the data flow of the text's rendering process.
44 class Typesetter : public RefObject
46 public: // Constructor.
48 * @brief Creates a Typesetter instance.
50 * The typesetter composes the final text retrieving the glyphs and the
51 * styles from the text's model.
53 * @param[in] model Pointer to the text's data model.
55 static TypesetterPtr New( const ModelInterface* const model );
59 * @brief Retrieves the pointer to the view model.
61 * @return A pointer to the view model.
63 ViewModel* GetViewModel();
66 * @brief Renders the text.
68 * Does the following operations:
69 * - Finds the visible pages needed to be rendered.
70 * - Elide glyphs if needed.
71 * - Retrieves the data buffers from the text model.
72 * - Creates the pixel data used to generate the final image with the given size.
73 * - Traverse the visible glyphs, retrieve their bitmaps and compose the final pixel data.
75 * @param[in] size The renderer size.
77 * @return A pixel data with the text rendered.
79 PixelData Render( const Vector2& size );
83 * @brief Private constructor.
85 * @param[in] model Pointer to the text's data model.
87 Typesetter( const ModelInterface* const model );
89 // Declared private and left undefined to avoid copies.
90 Typesetter( const Typesetter& handle );
92 // Declared private and left undefined to avoid copies.
93 Typesetter& operator=( const Typesetter& handle );
98 * @brief A reference counted object may only be deleted by calling Unreference().
100 * Destroys the visual model.
102 virtual ~Typesetter();
110 } // namespace Toolkit
114 #endif // DALI_TOOLKIT_TEXT_TYPESETTER_H