summaryrefslogtreecommitdiff
path: root/bk_text.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-21 18:07:26 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-21 18:07:26 +0000
commita010160576d6f6eb269902fe0e26c53bd56d29b1 (patch)
tree03d0fa9aabe1e1f444fcb957bd9d361999e86bb8 /bk_text.c
parentaa4e1956477f547f88e4a046e0b87b00bf4816cc (diff)
downloadhalibut-a010160576d6f6eb269902fe0e26c53bd56d29b1.zip
halibut-a010160576d6f6eb269902fe0e26c53bd56d29b1.tar.gz
halibut-a010160576d6f6eb269902fe0e26c53bd56d29b1.tar.bz2
halibut-a010160576d6f6eb269902fe0e26c53bd56d29b1.tar.xz
Charset support for the info backend (\cfg{info-charset}). (This
checkin touches other files because a function in bk_text.c turned out to be of more general use so I moved it out into ustring.c.) [originally from svn r4111]
Diffstat (limited to 'bk_text.c')
-rw-r--r--bk_text.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/bk_text.c b/bk_text.c
index d551741..373de74 100644
--- a/bk_text.c
+++ b/bk_text.c
@@ -360,22 +360,6 @@ void text_backend(paragraph *sourceform, keywordlist *keywords,
sfree(conf.filename);
}
-static int text_ok(int charset, const wchar_t *s)
-{
- char buf[256];
- charset_state state = CHARSET_INIT_STATE;
- int err, len = ustrlen(s);
-
- err = 0;
- while (len > 0) {
- (void)charset_from_unicode(&s, &len, buf, lenof(buf),
- charset, &state, &err);
- if (err)
- return FALSE;
- }
- return TRUE;
-}
-
static void text_output(textfile *tf, const wchar_t *s)
{
char buf[256];
@@ -441,7 +425,7 @@ static void text_rdaddw(int charset, rdstring *rs, word *text, word *end) {
attraux(text->aux) == attr_Only))
rdadd(rs, L'`'); /* FIXME: configurability */
if (removeattr(text->type) == word_Normal) {
- if (text_ok(charset, text->text) || !text->alt)
+ if (cvt_ok(charset, text->text) || !text->alt)
rdadds(rs, text->text);
else
text_rdaddw(charset, rs, text->alt, NULL);
@@ -495,7 +479,7 @@ static int text_width(void *ctx, word *text) {
? (attraux(text->aux) == attr_Only ? 2 :
attraux(text->aux) == attr_Always ? 0 : 1)
: 0) +
- (text_ok(charset, text->text) || !text->alt ?
+ (cvt_ok(charset, text->text) || !text->alt ?
ustrlen(text->text) :
text_width_list(ctx, text->alt)));