summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-19 17:09:12 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-19 17:09:12 +0000
commitf42941536c6c16ba8b89dd5f25d8a747e3d5495d (patch)
treeb2533971228e8aeca27debb8e0ebb2ce7a85c107
parentd74917688ba7d95ed71fe836091ec9d952f433e6 (diff)
downloadhalibut-f42941536c6c16ba8b89dd5f25d8a747e3d5495d.zip
halibut-f42941536c6c16ba8b89dd5f25d8a747e3d5495d.tar.gz
halibut-f42941536c6c16ba8b89dd5f25d8a747e3d5495d.tar.bz2
halibut-f42941536c6c16ba8b89dd5f25d8a747e3d5495d.tar.xz
Better robustness when backends encounter a Unicode character not
representable in the output character set. [originally from svn r4094]
-rw-r--r--bk_info.c4
-rw-r--r--bk_man.c2
-rw-r--r--bk_text.c4
-rw-r--r--bk_whlp.c2
-rw-r--r--bk_xhtml.c3
5 files changed, 8 insertions, 7 deletions
diff --git a/bk_info.c b/bk_info.c
index 0d7c032..f7f83fb 100644
--- a/bk_info.c
+++ b/bk_info.c
@@ -747,7 +747,7 @@ static void info_rdaddwc(rdstringc *rs, word *words, word *end, int xrefs) {
attraux(words->aux) == attr_Only))
rdaddc(rs, '`'); /* FIXME: configurability */
if (removeattr(words->type) == word_Normal) {
- if (info_convert(words->text, &c))
+ if (info_convert(words->text, &c) || !words->alt)
rdaddsc(rs, c);
else
info_rdaddwc(rs, words->alt, NULL, FALSE);
@@ -807,7 +807,7 @@ static int info_width_internal(word *words, int xrefs) {
? (attraux(words->aux) == attr_Only ? 2 :
attraux(words->aux) == attr_Always ? 0 : 1)
: 0) +
- (info_convert(words->text, NULL) ?
+ (info_convert(words->text, NULL) || !words->alt ?
ustrlen(words->text) :
info_width_internal_list(words->alt, xrefs)));
diff --git a/bk_man.c b/bk_man.c
index 60157fa..d03f6b7 100644
--- a/bk_man.c
+++ b/bk_man.c
@@ -372,7 +372,7 @@ static void man_rdaddwc(rdstringc *rs, word *text, word *end,
if (removeattr(text->type) == word_Normal) {
if (rs->pos > 0)
quote_props &= ~QUOTE_INITCTRL; /* not at start any more */
- if (man_convert(text->text, 0, &c, quote_props))
+ if (man_convert(text->text, 0, &c, quote_props) || !text->alt)
rdaddsc(rs, c);
else
man_rdaddwc(rs, text->alt, NULL, quote_props);
diff --git a/bk_text.c b/bk_text.c
index 359ea25..499f232 100644
--- a/bk_text.c
+++ b/bk_text.c
@@ -450,7 +450,7 @@ static void text_rdaddwc(rdstringc *rs, word *text, word *end) {
attraux(text->aux) == attr_Only))
rdaddc(rs, '`'); /* FIXME: configurability */
if (removeattr(text->type) == word_Normal) {
- if (text_convert(text->text, &c))
+ if (text_convert(text->text, &c) || !text->alt)
rdaddsc(rs, c);
else
text_rdaddwc(rs, text->alt, NULL);
@@ -505,7 +505,7 @@ static int text_width(void *ctx, word *text) {
? (attraux(text->aux) == attr_Only ? 2 :
attraux(text->aux) == attr_Always ? 0 : 1)
: 0) +
- (text_convert(text->text, NULL) ?
+ (text_convert(text->text, NULL) || !text->alt ?
ustrlen(text->text) :
text_width_list(ctx, text->alt)));
diff --git a/bk_whlp.c b/bk_whlp.c
index 9655b1f..7738c71 100644
--- a/bk_whlp.c
+++ b/bk_whlp.c
@@ -628,7 +628,7 @@ static void whlp_mkparagraph(struct bk_whlp_state *state,
whlp_set_font(state->h, newfont);
}
if (removeattr(text->type) == word_Normal) {
- if (whlp_convert(text->text, 0, &c, TRUE))
+ if (whlp_convert(text->text, 0, &c, TRUE) || !text->alt)
whlp_text(state->h, c);
else
whlp_mkparagraph(state, deffont, text->alt, FALSE);
diff --git a/bk_xhtml.c b/bk_xhtml.c
index aff20a3..4b9b98c 100644
--- a/bk_xhtml.c
+++ b/bk_xhtml.c
@@ -1651,7 +1651,8 @@ static void xhtml_rdaddwc(rdstringc *rs, word *text, word *end, int indexable) {
rdaddsc(rs, "<code>");
if (removeattr(text->type) == word_Normal) {
- if (xhtml_convert(text->text, 0, &c, TRUE)) /* spaces in the word are hard */
+ if (xhtml_convert(text->text, 0, &c, TRUE) || !text->alt)
+ /* spaces in the word are hard */
rdaddsc(rs, c);
else
xhtml_rdaddwc(rs, text->alt, NULL, indexable);