- line_codepage = charset_from_mimeenc(cfg.line_codepage);
- if (line_codepage == CS_NONE)
- line_codepage = charset_from_xenc(cfg.line_codepage);
- /* If it's still CS_NONE, we should assume direct-to-font. */
-
- /* FIXME: this is a hack. Currently fonts with incomprehensible
- * encodings are dealt with by pretending they're 8859-1. It's
- * ugly, but it's good enough to stop things crashing. Should do
- * something better here. */
- if (line_codepage == CS_NONE)
- line_codepage = CS_ISO8859_1;
+ ucsdata->line_codepage = charset_from_mimeenc(linecharset);
+ if (ucsdata->line_codepage == CS_NONE)
+ ucsdata->line_codepage = charset_from_xenc(linecharset);
+
+ /*
+ * If line_codepage is _still_ CS_NONE, we assume we're using
+ * the font's own encoding. This has been passed in to us, so
+ * we use that. If it's still CS_NONE after _that_ - i.e. the
+ * font we were given had an incomprehensible charset - then we
+ * fall back to using the D800 page.
+ */
+ if (ucsdata->line_codepage == CS_NONE)
+ ucsdata->line_codepage = font_charset;
+
+ if (ucsdata->line_codepage == CS_NONE)
+ ret = 1;