Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7858 views
1
#ifndef MUPDF_FITZ_TEXT_H
2
#define MUPDF_FITZ_TEXT_H
3
4
#include "mupdf/fitz/system.h"
5
#include "mupdf/fitz/context.h"
6
#include "mupdf/fitz/font.h"
7
#include "mupdf/fitz/path.h"
8
9
/*
10
* Text buffer.
11
*
12
* The trm field contains the a, b, c and d coefficients.
13
* The e and f coefficients come from the individual elements,
14
* together they form the transform matrix for the glyph.
15
*
16
* Glyphs are referenced by glyph ID.
17
* The Unicode text equivalent is kept in a separate array
18
* with indexes into the glyph array.
19
*/
20
21
typedef struct fz_text_s fz_text;
22
typedef struct fz_text_item_s fz_text_item;
23
24
struct fz_text_item_s
25
{
26
float x, y;
27
int gid; /* -1 for one gid to many ucs mappings */
28
int ucs; /* -1 for one ucs to many gid mappings */
29
};
30
31
struct fz_text_s
32
{
33
int refs;
34
fz_font *font;
35
fz_matrix trm;
36
int wmode;
37
int len, cap;
38
fz_text_item *items;
39
};
40
41
fz_text *fz_new_text(fz_context *ctx, fz_font *face, const fz_matrix *trm, int wmode);
42
fz_text *fz_keep_text(fz_context *ctx, fz_text *text);
43
void fz_drop_text(fz_context *ctx, fz_text *text);
44
45
void fz_add_text(fz_context *ctx, fz_text *text, int gid, int ucs, float x, float y);
46
fz_rect *fz_bound_text(fz_context *ctx, fz_text *text, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r);
47
void fz_print_text(fz_context *ctx, FILE *out, fz_text*);
48
49
#endif
50
51