summaryrefslogtreecommitdiff
path: root/amiga/font.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-07-06 19:29:16 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-07-06 19:29:16 +0100
commitc38670ade8c664fa511cebb4b5d2950b12e7bf81 (patch)
tree09fe38396c207fd935c817727f5ec2c78f21ced4 /amiga/font.c
parent8282f53880877f84b1fce05c5529e8994abcb690 (diff)
downloadnetsurf-c38670ade8c664fa511cebb4b5d2950b12e7bf81.tar.gz
netsurf-c38670ade8c664fa511cebb4b5d2950b12e7bf81.tar.bz2
Allow a fallback font for characters above 0xFFFF to be specified. There is no scanning of this range as most fonts don't have any characters here. Symbola is selected if it is installed.
Diffstat (limited to 'amiga/font.c')
-rw-r--r--amiga/font.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/amiga/font.c b/amiga/font.c
index 12375ad0f..c39b00264 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -162,7 +162,7 @@ static void ami_font_cleanup(struct MinList *ami_font_list);
static inline ULONG ami_font_unicode_width(const char *string, ULONG length,
const plot_font_style_t *fstyle, ULONG x, ULONG y, bool aa);
-static inline int amiga_nsfont_utf16_char_length(uint16 *char1)
+static inline int amiga_nsfont_utf16_char_length(const uint16 *char1)
{
if (__builtin_expect(((*char1 < 0xD800) || (0xDBFF < *char1)), 1)) {
return 1;
@@ -461,7 +461,12 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
break;
case NSA_UNICODE_FONT:
default:
- fontname = (char *)ami_font_scan_lookup(codepoint, glypharray);
+ if(__builtin_expect((amiga_nsfont_utf16_char_length(codepoint) == 2), 0)) {
+ /* Multi-byte character */
+ fontname = nsoption_charp(font_surrogate);
+ } else {
+ fontname = (char *)ami_font_scan_lookup(codepoint, glypharray);
+ }
if(fontname == NULL) return NULL;
break;
}
@@ -604,6 +609,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
long_char_1 = amiga_nsfont_decode_surrogate(char1);
long_char_2 = amiga_nsfont_decode_surrogate(char2);
+ /**\todo use OT_GlyphCode_32 so we get an error for old font engines */
if(ESetInfo(AMI_OFONT_ENGINE,
OT_GlyphCode, long_char_1,
@@ -690,6 +696,7 @@ static inline int32 ami_font_width_glyph(struct OutlineFont *ofont,
if (*char2 < 0x0020) skip_c2 = true;
long_char_1 = amiga_nsfont_decode_surrogate(char1);
+ /**\todo use OT_GlyphCode_32 so we get an error for old font engines */
if(ESetInfo(AMI_OFONT_ENGINE,
OT_GlyphCode, long_char_1,