mupdf
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1// Copyright (C) 2004-2024 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef MUPDF_FITZ_TEXT_H
24#define MUPDF_FITZ_TEXT_H
25
26#include "mupdf/fitz/system.h"
27#include "mupdf/fitz/context.h"
28#include "mupdf/fitz/font.h"
29#include "mupdf/fitz/path.h"
30#include "mupdf/fitz/bidi.h"
31
43
44typedef struct
45{
46 float x, y;
47 float adv; /* advance width given by input format */
48 int gid; /* -1 for one gid to many ucs mappings */
49 int ucs; /* -1 for one ucs to many gid mappings */
50 int cid; /* CID for CJK fonts, raw character code for other fonts; or unicode for non-PDF formats. */
52
53#define FZ_LANG_TAG2(c1,c2) ((c1-'a'+1) + ((c2-'a'+1)*27))
54#define FZ_LANG_TAG3(c1,c2,c3) ((c1-'a'+1) + ((c2-'a'+1)*27) + ((c3-'a'+1)*27*27))
55
67
68typedef struct fz_text_span
69{
72 unsigned wmode : 1; /* 0 horizontal, 1 vertical */
73 unsigned bidi_level : 7; /* The bidirectional level of text */
74 unsigned markup_dir : 2; /* The direction of text as marked in the original document */
75 unsigned language : 15; /* The language as marked in the original document */
76 int len, cap;
80
81typedef struct
82{
83 int refs;
85} fz_text;
86
93
101
108void fz_drop_text(fz_context *ctx, const fz_text *text);
109
138void fz_show_glyph_aux(fz_context *ctx, fz_text *text, fz_font *font, fz_matrix trm, float adv, int glyph, int unicode, int cid, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language lang);
139
164
173
189fz_rect fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm);
190
201
209
210#endif
fz_bidi_direction
Definition bidi.h:29
Definition context.h:886
Definition font.h:776
Definition geometry.h:388
Definition geometry.h:231
Definition path.h:58
Definition text.h:45
float x
Definition text.h:46
float adv
Definition text.h:47
int ucs
Definition text.h:49
int gid
Definition text.h:48
float y
Definition text.h:46
int cid
Definition text.h:50
Definition text.h:69
fz_text_item * items
Definition text.h:77
fz_font * font
Definition text.h:70
unsigned bidi_level
Definition text.h:73
unsigned markup_dir
Definition text.h:74
struct fz_text_span * next
Definition text.h:78
int len
Definition text.h:76
unsigned language
Definition text.h:75
fz_matrix trm
Definition text.h:71
unsigned wmode
Definition text.h:72
int cap
Definition text.h:76
Definition text.h:82
fz_text_span * tail
Definition text.h:84
int refs
Definition text.h:83
fz_text_span * head
Definition text.h:84
#define FZ_LANG_TAG3(c1, c2, c3)
Definition text.h:54
#define FZ_LANG_TAG2(c1, c2)
Definition text.h:53
fz_text * fz_keep_text(fz_context *ctx, const fz_text *text)
void fz_show_glyph_aux(fz_context *ctx, fz_text *text, fz_font *font, fz_matrix trm, float adv, int glyph, int unicode, int cid, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language lang)
fz_text * fz_new_text(fz_context *ctx)
fz_rect fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_state *stroke, fz_matrix ctm)
fz_text_language
Definition text.h:57
@ FZ_LANG_urd
Definition text.h:60
@ FZ_LANG_ur
Definition text.h:59
@ FZ_LANG_zh
Definition text.h:63
@ FZ_LANG_UNSET
Definition text.h:58
@ FZ_LANG_ja
Definition text.h:62
@ FZ_LANG_ko
Definition text.h:61
@ FZ_LANG_zh_Hant
Definition text.h:65
@ FZ_LANG_zh_Hans
Definition text.h:64
fz_text_language fz_text_language_from_string(const char *str)
void fz_drop_text(fz_context *ctx, const fz_text *text)
fz_matrix fz_show_string(fz_context *ctx, fz_text *text, fz_font *font, fz_matrix trm, const char *s, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language language)
char * fz_string_from_text_language(char str[8], fz_text_language lang)
void fz_show_glyph(fz_context *ctx, fz_text *text, fz_font *font, fz_matrix trm, int glyph, int unicode, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language language)
fz_matrix fz_measure_string(fz_context *ctx, fz_font *user_font, fz_matrix trm, const char *s, int wmode, int bidi_level, fz_bidi_direction markup_dir, fz_text_language language)