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.
This commit is contained in:
parent
fea40a0a78
commit
cba6bdb481
54
amiga/font.c
54
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
|
* 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 nsObject *node;
|
||||||
struct ami_font_node *nodedata;
|
struct ami_font_node *nodedata;
|
||||||
|
@ -383,7 +383,7 @@ static struct ami_font_node *ami_font_open(const char *font)
|
||||||
if(!nodedata->font)
|
if(!nodedata->font)
|
||||||
{
|
{
|
||||||
LOG("Requested font not found: %s", font);
|
LOG("Requested font not found: %s", font);
|
||||||
warn_user("CompError", font);
|
if(critical == true) warn_user("CompError", font);
|
||||||
FreeVec(nodedata);
|
FreeVec(nodedata);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -429,6 +429,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
|
||||||
const uint16 *codepoint)
|
const uint16 *codepoint)
|
||||||
{
|
{
|
||||||
struct ami_font_node *node;
|
struct ami_font_node *node;
|
||||||
|
struct ami_font_node *designed_node = NULL;
|
||||||
struct OutlineFont *ofont;
|
struct OutlineFont *ofont;
|
||||||
char *fontname;
|
char *fontname;
|
||||||
ULONG ysize;
|
ULONG ysize;
|
||||||
|
@ -471,7 +472,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = ami_font_open(fontname);
|
node = ami_font_open(fontname, true);
|
||||||
if(!node) return NULL;
|
if(!node) return NULL;
|
||||||
|
|
||||||
if (fstyle->flags & FONTF_OBLIQUE)
|
if (fstyle->flags & FONTF_OBLIQUE)
|
||||||
|
@ -486,13 +487,9 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
|
||||||
switch(tstyle)
|
switch(tstyle)
|
||||||
{
|
{
|
||||||
case NSA_ITALIC:
|
case NSA_ITALIC:
|
||||||
if(node->italic)
|
if(node->italic) designed_node = ami_font_open(node->italic, false);
|
||||||
{
|
|
||||||
node = ami_font_open(node->italic);
|
if(designed_node == NULL) {
|
||||||
if(!node) return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shearsin = NSA_VALUE_SHEARSIN;
|
shearsin = NSA_VALUE_SHEARSIN;
|
||||||
shearcos = NSA_VALUE_SHEARCOS;
|
shearcos = NSA_VALUE_SHEARCOS;
|
||||||
}
|
}
|
||||||
|
@ -504,13 +501,9 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSA_BOLD:
|
case NSA_BOLD:
|
||||||
if(node->bold)
|
if(node->bold) designed_node = ami_font_open(node->bold, false);
|
||||||
{
|
|
||||||
node = ami_font_open(node->bold);
|
if(designed_node == NULL) {
|
||||||
if(!node) return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emboldenx = NSA_VALUE_BOLDX;
|
emboldenx = NSA_VALUE_BOLDX;
|
||||||
emboldeny = NSA_VALUE_BOLDY;
|
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;
|
shearsin = NSA_VALUE_SHEARSIN;
|
||||||
shearcos = NSA_VALUE_SHEARCOS;
|
shearcos = NSA_VALUE_SHEARCOS;
|
||||||
|
|
||||||
if(node->bold)
|
if(node->bold) designed_node = ami_font_open(node->bold, false);
|
||||||
{
|
|
||||||
node = ami_font_open(node->bold);
|
if(designed_node == NULL) {
|
||||||
if(!node) return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emboldenx = NSA_VALUE_BOLDX;
|
emboldenx = NSA_VALUE_BOLDX;
|
||||||
emboldeny = NSA_VALUE_BOLDY;
|
emboldeny = NSA_VALUE_BOLDY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSA_BOLDITALIC:
|
case NSA_BOLDITALIC:
|
||||||
if(node->bolditalic)
|
if(node->bolditalic) designed_node = ami_font_open(node->bolditalic, false);
|
||||||
{
|
|
||||||
node = ami_font_open(node->bolditalic);
|
if(designed_node == NULL) {
|
||||||
if(!node) return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emboldenx = NSA_VALUE_BOLDX;
|
emboldenx = NSA_VALUE_BOLDX;
|
||||||
emboldeny = NSA_VALUE_BOLDY;
|
emboldeny = NSA_VALUE_BOLDY;
|
||||||
shearsin = NSA_VALUE_SHEARSIN;
|
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 */
|
/* Scale to 16.16 fixed point */
|
||||||
ysize = fstyle->size * ((1 << 16) / FONT_SIZE_SCALE);
|
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__
|
#ifndef __amigaos4__
|
||||||
struct BulletBase *BulletBase = ofont->BulletBase;
|
struct BulletBase *BulletBase = ofont->BulletBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue