summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-08-19 19:15:06 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-08-19 19:15:06 +0100
commitcba6bdb481545e404e0769b051090b16046a99f5 (patch)
tree3a687b287f4c77689e17233d9b0362c9ae50527b /amiga
parentfea40a0a78a70a29573bbdc940ea6f9ccdb6093b (diff)
downloadnetsurf-cba6bdb481545e404e0769b051090b16046a99f5.tar.gz
netsurf-cba6bdb481545e404e0769b051090b16046a99f5.tar.bz2
If a designed (bold, italic, etc) version of a specific font is set but not actually installed, treat this as a non-critical error, log it, and create a computed version.
Diffstat (limited to 'amiga')
-rw-r--r--amiga/font.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/amiga/font.c b/amiga/font.c
index 19cef604e..5f661c4dc 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -362,7 +362,7 @@ static inline bool amiga_nsfont_split(const plot_font_style_t *fstyle,
/**
* Search for a font in the list and load from disk if not present
*/
-static struct ami_font_node *ami_font_open(const char *font)
+static struct ami_font_node *ami_font_open(const char *font, bool critical)
{
struct nsObject *node;
struct ami_font_node *nodedata;
@@ -383,7 +383,7 @@ static struct ami_font_node *ami_font_open(const char *font)
if(!nodedata->font)
{
LOG("Requested font not found: %s", font);
- warn_user("CompError", font);
+ if(critical == true) warn_user("CompError", font);
FreeVec(nodedata);
return NULL;
}
@@ -429,6 +429,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
const uint16 *codepoint)
{
struct ami_font_node *node;
+ struct ami_font_node *designed_node = NULL;
struct OutlineFont *ofont;
char *fontname;
ULONG ysize;
@@ -471,7 +472,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
break;
}
- node = ami_font_open(fontname);
+ node = ami_font_open(fontname, true);
if(!node) return NULL;
if (fstyle->flags & FONTF_OBLIQUE)
@@ -486,13 +487,9 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
switch(tstyle)
{
case NSA_ITALIC:
- if(node->italic)
- {
- node = ami_font_open(node->italic);
- if(!node) return NULL;
- }
- else
- {
+ if(node->italic) designed_node = ami_font_open(node->italic, false);
+
+ if(designed_node == NULL) {
shearsin = NSA_VALUE_SHEARSIN;
shearcos = NSA_VALUE_SHEARCOS;
}
@@ -504,13 +501,9 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
break;
case NSA_BOLD:
- if(node->bold)
- {
- node = ami_font_open(node->bold);
- if(!node) return NULL;
- }
- else
- {
+ if(node->bold) designed_node = ami_font_open(node->bold, false);
+
+ if(designed_node == NULL) {
emboldenx = NSA_VALUE_BOLDX;
emboldeny = NSA_VALUE_BOLDY;
}
@@ -520,26 +513,18 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
shearsin = NSA_VALUE_SHEARSIN;
shearcos = NSA_VALUE_SHEARCOS;
- if(node->bold)
- {
- node = ami_font_open(node->bold);
- if(!node) return NULL;
- }
- else
- {
+ if(node->bold) designed_node = ami_font_open(node->bold, false);
+
+ if(designed_node == NULL) {
emboldenx = NSA_VALUE_BOLDX;
emboldeny = NSA_VALUE_BOLDY;
}
break;
case NSA_BOLDITALIC:
- if(node->bolditalic)
- {
- node = ami_font_open(node->bolditalic);
- if(!node) return NULL;
- }
- else
- {
+ if(node->bolditalic) designed_node = ami_font_open(node->bolditalic, false);
+
+ if(designed_node == NULL) {
emboldenx = NSA_VALUE_BOLDX;
emboldeny = NSA_VALUE_BOLDY;
shearsin = NSA_VALUE_SHEARSIN;
@@ -551,7 +536,12 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
/* Scale to 16.16 fixed point */
ysize = fstyle->size * ((1 << 16) / FONT_SIZE_SCALE);
- ofont = node->font;
+ if(designed_node == NULL) {
+ ofont = node->font;
+ } else {
+ ofont = designed_node->font;
+ }
+
#ifndef __amigaos4__
struct BulletBase *BulletBase = ofont->BulletBase;
#endif