1 #ifndef __DALI_INTERNAL_TEXT_REQUEST_HELPER_H__
2 #define __DALI_INTERNAL_TEXT_REQUEST_HELPER_H__
5 * Copyright (c) 2014 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/object/ref-object.h>
23 #include <dali/internal/event/text/font-declarations.h>
24 #include <dali/internal/event/text/text-format.h>
25 #include <dali/internal/common/text-vertex-buffer.h>
26 #include <dali/internal/event/text/resource/glyph-texture-observer.h>
27 #include <dali/integration-api/text-array.h>
36 * Used to control text requests passed to a font object.
37 * Characters are reference counted by the font object. This
38 * class ensures the correct characters are reference / unreferenced.
41 class TextRequestHelper
48 * @param[in] observer glyph texture observer
50 TextRequestHelper( GlyphTextureObserver& observer );
59 * Set the text to request
60 * @param [in] text text string
61 * @param [in] format text format
62 * @return the vertex data required to draw the text
64 TextVertexBuffer* SetText(const Integration::TextArray& text, const TextFormat& format );
69 * @param [in] format text format
70 * @return the vertex data required to draw the text
72 TextVertexBuffer* SetFont( const FontPointer& font, const TextFormat& format );
75 * Set the text and font to request
76 * @param [in] text the text string
77 * @param [in] font new font to request from
78 * @param [in] format text format
79 * @return the vertex data required to draw the text
81 TextVertexBuffer* SetTextAndFont(const Integration::TextArray& text, const FontPointer& font, const TextFormat& format );
84 * Called when the texture id has changed
85 * @param[in] old texture id
86 * @param[in] new texture id
88 void TextureChanged( unsigned int oldTextureId, unsigned int newTextureId );
91 * Check if the text is loaded
92 * @return true if text is loaded
94 bool IsTextLoaded() const;
99 * Tell the font we have stopped using a string of characters
101 void TextNotRequired();
104 * Tell the font we require some text
105 * @param[in] format the text format
106 * @return the vertex data required to draw the text
108 TextVertexBuffer* TextRequired( const TextFormat& format );
111 * start observing global atlas changes such as atlas resize / split
113 void AddTextureObserver();
115 unsigned int mTextureId; ///< the texture id of the glyph atlas being used
116 Integration::TextArray mText; ///< text string
117 TextFormat mFormat; ///< text format
118 FontPointer mFont; ///< the font
119 bool mTextureObserverInstalled:1; ///< whether texture observer is installed
120 GlyphTextureObserver& mTextureObserver; ///< texture observer
124 } // namespace Internal
128 #endif // __DALI_INTERNAL_TEXT_REQUEST_HELPER_H__