Cobbletext  0.2.0
Complex text layout and rendering engine
engine.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 
6 #include "uchar_helper.h"
7 
8 #include "common.h"
9 #include "encoding.h"
10 #include "engine_properties.h"
11 #include "library.h"
12 #include "macros.h"
13 #include "script_direction.h"
14 #include "text_properties.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
31 
32 
42 
48 
58  CobbletextEngine * engine);
59 
67  const struct CobbletextEngineProperties * properties);
68 
78  CobbletextEngine * engine);
79 
89  const struct CobbletextTextProperties * text_properties);
90 
99 void cobbletext_engine_add_text(CobbletextEngine * engine, const uint8_t * data,
100  int32_t length, CobbletextEncoding encoding);
101 
111  const char * text, int32_t length);
112 
122  const CobbletextChar16 * text, int32_t length);
123 
133  const CobbletextChar32 * text, int32_t length);
134 
144  CobbletextInlineObjectID id, uint32_t width, uint32_t height);
145 
154 
169 
177 
193 
204 
212 bool cobbletext_engine_pack_tiles(CobbletextEngine * engine, uint32_t width,
213  uint32_t height);
214 
225 
233 
244  CobbletextEngine * engine);
245 
253 
261 
270  CobbletextEngine * engine);
271 
280  CobbletextEngine * engine);
281 
282 #ifdef __cplusplus
283 }
284 #endif
cobbletext_engine_rasterize
void cobbletext_engine_rasterize(CobbletextEngine *engine)
Convert the glyphs required by this engine to coverages maps for drawing the text.
cobbletext_engine_clear
void cobbletext_engine_clear(CobbletextEngine *engine)
Empty the text buffer.
CobbletextAdvanceInfo
Representation of a pen drawing instruction.
Definition: advance_info.h:66
CobbletextOutputInfo
Sizes for the rendered text.
Definition: output_info.h:23
cobbletext_engine_set_properties
void cobbletext_engine_set_properties(CobbletextEngine *engine, const struct CobbletextEngineProperties *properties)
Sets engine properties.
cobbletext_engine_delete
void cobbletext_engine_delete(CobbletextEngine *engine)
Frees the engine.
CobbletextInlineObjectID
uint32_t CobbletextInlineObjectID
A user-provided identifer for inline objects.
Definition: common.h:38
encoding.h
uchar_helper.h
cobbletext_engine_get_properties
const struct CobbletextEngineProperties * cobbletext_engine_get_properties(CobbletextEngine *engine)
Returns the engine properties.
script_direction.h
cobbletext_engine_tiles_valid
bool cobbletext_engine_tiles_valid(CobbletextEngine *engine)
Returns whether the associated glyphs to this engine is not stale.
macros.h
cobbletext_engine_pack_tiles
bool cobbletext_engine_pack_tiles(CobbletextEngine *engine, uint32_t width, uint32_t height)
Texture pack the associated glyphs.
text_properties.h
engine_properties.h
cobbletext_engine_get_advances
const struct CobbletextAdvanceInfo ** cobbletext_engine_get_advances(CobbletextEngine *engine)
Return the advances array.
CobbletextLibrary
struct CobbletextLibrary CobbletextLibrary
Opaque handle to the library's context.
Definition: library.h:24
CobbletextEncoding
uint8_t CobbletextEncoding
Specifies the encoding of bytes.
Definition: encoding.h:17
cobbletext_engine_get_tile_count
uint32_t cobbletext_engine_get_tile_count(CobbletextEngine *engine)
Returns the number of tiles in the tiles array.
cobbletext_engine_get_tiles
const struct CobbletextTileInfo ** cobbletext_engine_get_tiles(CobbletextEngine *engine)
Returns the array of tiles.
CobbletextTextProperties
Properties for text runs on a struct CobbletextEngine instance.
Definition: text_properties.h:13
CobbletextEngineProperties
Properties for controlling output parameters on a struct CobbletextEngine instance.
Definition: engine_properties.h:15
cobbletext_engine_set_text_properties
void cobbletext_engine_set_text_properties(CobbletextEngine *engine, const struct CobbletextTextProperties *text_properties)
Sets the current text properties.
cobbletext_engine_get_advance_count
uint32_t cobbletext_engine_get_advance_count(CobbletextEngine *engine)
Return the number advances in the advances array.
cobbletext_engine_clear_tiles
void cobbletext_engine_clear_tiles(CobbletextEngine *engine)
Clear associated tiles and glyphs.
library.h
cobbletext_engine_prepare_tiles
void cobbletext_engine_prepare_tiles(CobbletextEngine *engine)
Prepares an array of tiles required for getting glyph images.
CobbletextTileInfo
Representation of a rendered glyph for an #CobbletextEngine.
Definition: tile_info.h:12
cobbletext_engine_add_text_utf16
void cobbletext_engine_add_text_utf16(CobbletextEngine *engine, const CobbletextChar16 *text, int32_t length)
Append UTF-16 code units to the text buffer.
CobbletextEngine
struct CobbletextEngine CobbletextEngine
Opaque handle to a layout and render engine.
Definition: engine.h:30
cobbletext_engine_get_output_info
const struct CobbletextOutputInfo * cobbletext_engine_get_output_info(CobbletextEngine *engine)
Returns information about the lay out operation.
COBBLETEXT_API
#define COBBLETEXT_API
Macro for Windows C symbol import and export, Emscripten attribute.
Definition: macros.h:18
common.h
cobbletext_engine_prepare_advances
void cobbletext_engine_prepare_advances(CobbletextEngine *engine)
Prepare an array of advances required for positioning glyphs.
CobbletextChar16
char16_t CobbletextChar16
Definition: uchar_helper.h:6
cobbletext_engine_new
CobbletextEngine * cobbletext_engine_new(CobbletextLibrary *library)
Creates a new layout engine.
cobbletext_engine_lay_out
void cobbletext_engine_lay_out(CobbletextEngine *engine)
Process and shape the text.
cobbletext_engine_add_inline_object
void cobbletext_engine_add_inline_object(CobbletextEngine *engine, CobbletextInlineObjectID id, uint32_t width, uint32_t height)
Append a placeholder for an object to the text buffer.
CobbletextChar32
char32_t CobbletextChar32
Definition: uchar_helper.h:7
cobbletext_engine_get_text_properties
const struct CobbletextTextProperties * cobbletext_engine_get_text_properties(CobbletextEngine *engine)
Returns the current text properties.
cobbletext_engine_add_text_utf8
void cobbletext_engine_add_text_utf8(CobbletextEngine *engine, const char *text, int32_t length)
Append UTF-8 code units to the text buffer.
cobbletext_engine_add_text
void cobbletext_engine_add_text(CobbletextEngine *engine, const uint8_t *data, int32_t length, CobbletextEncoding encoding)
Append encoded bytes to the text buffer.
cobbletext_engine_add_text_utf32
void cobbletext_engine_add_text_utf32(CobbletextEngine *engine, const CobbletextChar32 *text, int32_t length)
Append UTF-32 code units to the text buffer.