Skip to content

Commit 2025213

Browse files
SiegeLordExSiegeLord
authored andcommitted
Mark the backup and the glyph API as unstable.
Also, split out some internals from allegro_font.h into an internal header, so we don't have to install aintern_list.h.
1 parent 349cedc commit 2025213

File tree

12 files changed

+67
-36
lines changed

12 files changed

+67
-36
lines changed

addons/font/allegro5/allegro_font.h

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define __al_included_allegro5_allegro_font_h
33

44
#include "allegro5/allegro.h"
5-
#include "allegro5/internal/aintern_list.h"
65

76
#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
87
#ifndef ALLEGRO_STATICLINK
@@ -47,19 +46,11 @@
4746
/* Type: ALLEGRO_FONT
4847
*/
4948
typedef struct ALLEGRO_FONT ALLEGRO_FONT;
49+
#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_FONT_SRC)
50+
5051
/* Type: ALLEGRO_GLYPH
5152
*/
5253
typedef struct ALLEGRO_GLYPH ALLEGRO_GLYPH;
53-
typedef struct ALLEGRO_FONT_VTABLE ALLEGRO_FONT_VTABLE;
54-
55-
struct ALLEGRO_FONT
56-
{
57-
void *data;
58-
int height;
59-
ALLEGRO_FONT *fallback;
60-
ALLEGRO_FONT_VTABLE *vtable;
61-
_AL_LIST_ITEM *dtor_item;
62-
};
6354

6455
struct ALLEGRO_GLYPH
6556
{
@@ -73,30 +64,7 @@ struct ALLEGRO_GLYPH
7364
int offset_y;
7465
int advance;
7566
};
76-
77-
/* text- and font-related stuff */
78-
struct ALLEGRO_FONT_VTABLE
79-
{
80-
ALLEGRO_FONT_METHOD(int, font_height, (const ALLEGRO_FONT *f));
81-
ALLEGRO_FONT_METHOD(int, font_ascent, (const ALLEGRO_FONT *f));
82-
ALLEGRO_FONT_METHOD(int, font_descent, (const ALLEGRO_FONT *f));
83-
ALLEGRO_FONT_METHOD(int, char_length, (const ALLEGRO_FONT *f, int ch));
84-
ALLEGRO_FONT_METHOD(int, text_length, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *text));
85-
ALLEGRO_FONT_METHOD(int, render_char, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float x, float y));
86-
ALLEGRO_FONT_METHOD(int, render, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, const ALLEGRO_USTR *text, float x, float y));
87-
ALLEGRO_FONT_METHOD(void, destroy, (ALLEGRO_FONT *f));
88-
ALLEGRO_FONT_METHOD(void, get_text_dimensions, (const ALLEGRO_FONT *f,
89-
const ALLEGRO_USTR *text, int *bbx, int *bby, int *bbw, int *bbh));
90-
ALLEGRO_FONT_METHOD(int, get_font_ranges, (ALLEGRO_FONT *font,
91-
int ranges_count, int *ranges));
92-
93-
ALLEGRO_FONT_METHOD(bool, get_glyph_dimensions, (const ALLEGRO_FONT *f,
94-
int codepoint, int *bbx, int *bby, int *bbw, int *bbh));
95-
ALLEGRO_FONT_METHOD(int, get_glyph_advance, (const ALLEGRO_FONT *font,
96-
int codepoint1, int codepoint2));
97-
98-
ALLEGRO_FONT_METHOD(bool, get_glyph, (const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph));
99-
};
67+
#endif
10068

10169
enum {
10270
ALLEGRO_NO_KERNING = -1,
@@ -147,7 +115,9 @@ ALLEGRO_FONT_FUNC(bool, al_get_glyph_dimensions, (const ALLEGRO_FONT *f,
147115
int codepoint, int *bbx, int *bby, int *bbw, int *bbh));
148116
ALLEGRO_FONT_FUNC(int, al_get_glyph_advance, (const ALLEGRO_FONT *f,
149117
int codepoint1, int codepoint2));
118+
#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_FONT_SRC)
150119
ALLEGRO_FONT_FUNC(bool, al_get_glyph, (const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph));
120+
#endif
151121

152122
ALLEGRO_FONT_FUNC(void, al_draw_multiline_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *text));
153123
ALLEGRO_FONT_FUNC(void, al_draw_multiline_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *format, ...));
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#ifndef __al_included_allegro_aintern_font_h
2+
#define __al_included_allegro_aintern_font_h
3+
4+
#include "allegro5/internal/aintern_list.h"
5+
6+
typedef struct ALLEGRO_FONT_VTABLE ALLEGRO_FONT_VTABLE;
7+
8+
struct ALLEGRO_FONT
9+
{
10+
void *data;
11+
int height;
12+
ALLEGRO_FONT *fallback;
13+
ALLEGRO_FONT_VTABLE *vtable;
14+
_AL_LIST_ITEM *dtor_item;
15+
};
16+
17+
/* text- and font-related stuff */
18+
struct ALLEGRO_FONT_VTABLE
19+
{
20+
ALLEGRO_FONT_METHOD(int, font_height, (const ALLEGRO_FONT *f));
21+
ALLEGRO_FONT_METHOD(int, font_ascent, (const ALLEGRO_FONT *f));
22+
ALLEGRO_FONT_METHOD(int, font_descent, (const ALLEGRO_FONT *f));
23+
ALLEGRO_FONT_METHOD(int, char_length, (const ALLEGRO_FONT *f, int ch));
24+
ALLEGRO_FONT_METHOD(int, text_length, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *text));
25+
ALLEGRO_FONT_METHOD(int, render_char, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float x, float y));
26+
ALLEGRO_FONT_METHOD(int, render, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, const ALLEGRO_USTR *text, float x, float y));
27+
ALLEGRO_FONT_METHOD(void, destroy, (ALLEGRO_FONT *f));
28+
ALLEGRO_FONT_METHOD(void, get_text_dimensions, (const ALLEGRO_FONT *f,
29+
const ALLEGRO_USTR *text, int *bbx, int *bby, int *bbw, int *bbh));
30+
ALLEGRO_FONT_METHOD(int, get_font_ranges, (ALLEGRO_FONT *font,
31+
int ranges_count, int *ranges));
32+
33+
ALLEGRO_FONT_METHOD(bool, get_glyph_dimensions, (const ALLEGRO_FONT *f,
34+
int codepoint, int *bbx, int *bby, int *bbw, int *bbh));
35+
ALLEGRO_FONT_METHOD(int, get_glyph_advance, (const ALLEGRO_FONT *font,
36+
int codepoint1, int codepoint2));
37+
38+
ALLEGRO_FONT_METHOD(bool, get_glyph, (const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph));
39+
};
40+
41+
#endif

addons/font/font.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "allegro5/allegro_font.h"
1818
#include "allegro5/internal/aintern.h"
1919
#include "allegro5/internal/aintern_bitmap.h"
20+
#include "allegro5/internal/aintern_font.h"
2021
#include "allegro5/internal/aintern_exitfunc.h"
2122
#include "allegro5/internal/aintern_vector.h"
2223

addons/font/font.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef __al_included_allegro5_font_h
22
#define __al_included_allegro5_font_h
33

4+
#include "allegro5/internal/aintern_font.h"
5+
46
extern ALLEGRO_FONT_VTABLE _al_font_vtable_color;
57

68
typedef struct ALLEGRO_FONT_COLOR_DATA

addons/font/text.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "allegro5/allegro_font.h"
2828
#include "allegro5/internal/aintern_dtor.h"
29+
#include "allegro5/internal/aintern_font.h"
2930
#include "allegro5/internal/aintern_system.h"
3031

3132
/* If you call this, you're probably making a mistake. */

addons/ttf/ttf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define ALLEGRO_INTERNAL_UNSTABLE
2+
13
#include "allegro5/allegro.h"
24
#ifdef ALLEGRO_CFG_OPENGL
35
#include "allegro5/allegro_opengl.h"
@@ -6,6 +8,7 @@
68
#include "allegro5/internal/aintern_vector.h"
79

810
#include "allegro5/allegro_ttf.h"
11+
#include "allegro5/internal/aintern_font.h"
912
#include "allegro5/internal/aintern_ttf_cfg.h"
1013
#include "allegro5/internal/aintern_dtor.h"
1114
#include "allegro5/internal/aintern_system.h"

cmake/FileList.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ set(ALLEGRO_INCLUDE_ALLEGRO_INLINE_FILES
263263
set(ALLEGRO_INCLUDE_ALLEGRO_INTERNAL_FILES
264264
# Only files which need to be installed.
265265
include/allegro5/internal/alconfig.h
266-
include/allegro5/internal/aintern_list.h
267266
)
268267

269268
set(ALLEGRO_INCLUDE_ALLEGRO_OPENGL_FILES

docs/src/refman/font.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ next character in a string and includes kerning.
4848

4949
Since: 5.2.1
5050

51+
> *[Unstable API]:* This API is new and subject to refinement.
52+
5153
See also: [al_get_glyph]
5254

5355
### API: al_init_font_addon
@@ -783,4 +785,6 @@ to this function for future compatibility.
783785

784786
Since: 5.2.1
785787

788+
> *[Unstable API]:* This API is new and subject to refinement.
789+
786790
See also: [ALLEGRO_GLYPH]

docs/src/refman/graphics.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,8 @@ bitmap is backed up right away instead of during the next flip.
18951895

18961896
Since: 5.2.1
18971897

1898+
> *[Unstable API]:* This API is new and subject to refinement.
1899+
18981900
See also: [al_backup_dirty_bitmaps], [al_create_bitmap]
18991901

19001902

@@ -1904,5 +1906,7 @@ Backs up all of a display's bitmaps to system memory.
19041906

19051907
Since: 5.2.1
19061908

1909+
> *[Unstable API]:* This API is new and subject to refinement.
1910+
19071911
See also: [al_backup_dirty_bitmap]
19081912

examples/ex_ttf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define ALLEGRO_UNSTABLE
2+
13
#include <stdio.h>
24
#include <allegro5/allegro.h>
35
#include <allegro5/allegro_ttf.h>

0 commit comments

Comments
 (0)