summaryrefslogtreecommitdiff
path: root/source/html/html-layout.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-03-01 00:34:49 +0100
committerSebastian Rasmussen <sebras@gmail.com>2016-03-02 00:13:05 +0100
commit34ca477b353a48b315ef8dc598c35f9ddca20370 (patch)
tree8ada958c4264c42615c9c1625a37cf01fbfc6a3f /source/html/html-layout.c
parent9c7536238c872ca3b4d7ab864c1ee9aef039501d (diff)
downloadmupdf-34ca477b353a48b315ef8dc598c35f9ddca20370.tar.xz
Move UTF-8 string length function to fitz.
Diffstat (limited to 'source/html/html-layout.c')
-rw-r--r--source/html/html-layout.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c
index 5b84df6b..7be32592 100644
--- a/source/html/html-layout.c
+++ b/source/html/html-layout.c
@@ -1808,19 +1808,6 @@ typedef struct
uni_buf *buffer;
} bidi_data;
-static size_t utf8len(const char *text)
-{
- size_t len = 0;
-
- while (*text)
- {
- int rune;
- text += fz_chartorune(&rune, text);
- len++;
- }
- return len;
-}
-
static void newFragCb(const uint32_t *fragment,
size_t fragment_len,
int block_r2l,
@@ -1855,12 +1842,12 @@ static void newFragCb(const uint32_t *fragment,
else
{
/* Must be text */
- len = utf8len(data->flow->content.text);
+ len = fz_utflen(data->flow->content.text);
if (len > fragment_len)
{
/* We need to split this flow box */
(void)split_flow(data->ctx, data->pool, data->flow, fragment_len);
- len = utf8len(data->flow->content.text);
+ len = fz_utflen(data->flow->content.text);
}
}
@@ -1905,7 +1892,7 @@ detect_flow_directionality(fz_context *ctx, fz_pool *pool, uni_buf *buffer, fz_b
switch (end->type)
{
case FLOW_WORD:
- len = utf8len(end->content.text);
+ len = fz_utflen(end->content.text);
text = end->content.text;
break;
case FLOW_SPACE: