summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/text.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-03-11 16:10:51 +0000
committerRobin Watts <robin.watts@artifex.com>2016-03-11 16:48:03 +0000
commit3272c66cee887b997171854484fa8a8086884b12 (patch)
tree06c188493903c7d2684d0467c127b0c3efd64ed8 /include/mupdf/fitz/text.h
parenta3785935df081674d048655048984bcba09f8387 (diff)
downloadmupdf-3272c66cee887b997171854484fa8a8086884b12.tar.xz
Implement fz_text_language support functions.
Add code to convert to and from fz_text_language codes from ISO 639 language strings. No validation is carried out.
Diffstat (limited to 'include/mupdf/fitz/text.h')
-rw-r--r--include/mupdf/fitz/text.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/mupdf/fitz/text.h b/include/mupdf/fitz/text.h
index 682517c4..84f72957 100644
--- a/include/mupdf/fitz/text.h
+++ b/include/mupdf/fitz/text.h
@@ -39,7 +39,7 @@ typedef enum fz_text_direction_e
typedef enum fz_text_language_e
{
- fz_lang_unset = 0
+ FZ_LANG_UNSET = 0
/* FIXME: Fill in more */
} fz_text_language;
@@ -50,7 +50,7 @@ struct fz_text_span_s
int wmode : 1; /* 0 horizontal, 1 vertical */
int bidi_level : 7; /* The bidirectional level of text */
int markup_dir : 2; /* The direction of text as marked in the original document */
- int language : 8; /* The language as marked in the original document */
+ int language : 15; /* The language as marked in the original document */
int len, cap;
fz_text_item *items;
fz_text_span *next;
@@ -72,4 +72,23 @@ fz_rect *fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_sta
fz_text *fz_clone_text(fz_context *ctx, const fz_text *text);
+/*
+ Convert ISO 639 (639-{1,2,3,5}) language specification
+ strings losslessly to a 15 bit fz_text_language code.
+
+ No validation is carried out. Obviously invalid (out
+ of spec) codes will be mapped to FZ_LANG_UNSET, but
+ well-formed (but undefined) codes will be blithely
+ accepted.
+*/
+fz_text_language fz_text_language_from_string(const char *str);
+
+/*
+ Recover ISO 639 (639-{1,2,3,5}) language specification
+ strings losslessly from a 15 bit fz_text_language code.
+
+ No validation is carried out. See note above.
+*/
+char *fz_string_from_text_language(char str[4], fz_text_language lang);
+
#endif