Generated by Doxygen 1.8.14
Neographics
text.h
1 #pragma once
2 #include <pebble.h>
3 #include "../types.h"
4 #include "../macros.h"
5 #include "../context.h"
6 #include "../fonts/fonts.h"
7 
8 /*-----------------------------------------------------------------------------.
9 | |
10 | Text |
11 | |
12 `-----------------------------------------------------------------------------*/
13 
22 typedef enum n_GTextOverflowMode {
23  n_GTextOverflowModeWordWrap = 0,
24  // "Normal" filling mode. Respects \n, cuts off at end.
25  n_GTextOverflowModeTrailingEllipsis,
26  // Like WordWrap, but adds a trailing ellipsis at the last renderable
27  // position if there is additional text.
28  n_GTextOverflowModeFill,
29  // Renders \n as a space. Has a trailing ellipsis. Is buggy.
31 
35 typedef enum n_GTextAlignment {
36  n_GTextAlignmentLeft = 0,
37  n_GTextAlignmentCenter,
38  n_GTextAlignmentRight,
40 
45 typedef struct n_GTextAttributes {
46  bool use_screen_text_flow;
47  uint8_t inset;
48  bool use_paging;
49  n_GRect pageable_area;
50  n_GPoint text_origin;
51 } __attribute__((__packed__)) n_GTextAttributes;
52 
57 
62 
67  n_GTextAttributes * text_attributes, uint8_t inset);
68 
73  n_GTextAttributes * text_attributes);
74 
79  n_GTextAttributes * text_attributes, n_GPoint moduloed_origin, n_GRect pageable_area);
80 
85  n_GContext * ctx, const char * text, n_GFont const font, const n_GRect box,
86  const n_GTextOverflowMode overflow_mode, const n_GTextAlignment alignment,
87  n_GTextAttributes * text_attributes);
88 
93  const char * text, n_GFont const font, const n_GRect box,
94  const n_GTextOverflowMode overflow_mode, const n_GTextAlignment alignment,
95  n_GTextAttributes * text_attributes);
96 
100 #define n_graphics_text_layout_get_content_size(a, b, c, d)\
101  (n_graphics_text_layout_get_content_size_with_attributes((a), (b), (c), (d), NULL));
102 
void n_graphics_text_attributes_enable_paging(n_GTextAttributes *text_attributes, n_GPoint moduloed_origin, n_GRect pageable_area)
void n_graphics_text_attributes_destroy(n_GTextAttributes *text_attributes)
struct n_GTextAttributes __attribute__((__packed__)) n_GTextAttributes
n_GTextOverflowMode
Definition: text.h:22
void n_graphics_text_attributes_restore_default_paging(n_GTextAttributes *text_attributes)
n_GTextAlignment
Definition: text.h:35
void n_graphics_draw_text(n_GContext *ctx, const char *text, n_GFont const font, const n_GRect box, const n_GTextOverflowMode overflow_mode, const n_GTextAlignment alignment, n_GTextAttributes *text_attributes)
Definition: text.c:56
Definition: fonts.h:24
Definition: context.h:28
Definition: text.h:45
n_GTextAttributes * n_graphics_text_attributes_create(void)
Definition: rect.h:22
Definition: point.h:24
Definition: size.h:22
void n_graphics_text_attributes_enable_screen_text_flow(n_GTextAttributes *text_attributes, uint8_t inset)
n_GSize n_graphics_text_layout_get_content_size_with_attributes(const char *text, n_GFont const font, const n_GRect box, const n_GTextOverflowMode overflow_mode, const n_GTextAlignment alignment, n_GTextAttributes *text_attributes)