Extended font specification (for other drivers)
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2258 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -11,6 +11,7 @@ image.dpi.y=300
|
|||||||
# width and height in inches; v-trimmed A3
|
# width and height in inches; v-trimmed A3
|
||||||
image.width=11.69
|
image.width=11.69
|
||||||
image.height=14.56
|
image.height=14.56
|
||||||
|
# color specified as RRGGBB in hexadecimal
|
||||||
image.backcolor=200020
|
image.backcolor=200020
|
||||||
# layer Order
|
# layer Order
|
||||||
image.layers=sois,grid,soinames,clusters,stars,starnums,cnames
|
image.layers=sois,grid,soinames,clusters,stars,starnums,cnames
|
||||||
@@ -26,8 +27,8 @@ grid.origin.y=0.6
|
|||||||
grid.width=10.49
|
grid.width=10.49
|
||||||
grid.height=10.49
|
grid.height=10.49
|
||||||
grid.color=9566cb
|
grid.color=9566cb
|
||||||
# font: Arial Bold
|
grid.font.name=Arial Bold
|
||||||
grid.font.name=Arialbd.ttf
|
grid.font.filename=Arialbd.ttf
|
||||||
# font point size is in 1/64th of an inch
|
# font point size is in 1/64th of an inch
|
||||||
grid.font.size=8
|
grid.font.size=8
|
||||||
# weight is in 1/64th of an inch
|
# weight is in 1/64th of an inch
|
||||||
@@ -39,8 +40,8 @@ grid.marks.color=8771b6
|
|||||||
|
|
||||||
stars.definition=stars.map
|
stars.definition=stars.map
|
||||||
stars.numcolor=989898
|
stars.numcolor=989898
|
||||||
# font: Times New Roman
|
stars.desig.font.name=Times New Roman
|
||||||
stars.desig.font.name=Times.ttf
|
stars.desig.font.filename=Times.ttf
|
||||||
stars.desig.font.size=4
|
stars.desig.font.size=4
|
||||||
# designation letters/symbols in utf8 for the specified font
|
# designation letters/symbols in utf8 for the specified font
|
||||||
# using Greek letters
|
# using Greek letters
|
||||||
@@ -107,8 +108,8 @@ stars.W.3.color=f0f0f0
|
|||||||
# Star Clusters
|
# Star Clusters
|
||||||
|
|
||||||
clusters.definition=clusters.map
|
clusters.definition=clusters.map
|
||||||
# font: Arial Narrow Bold
|
clusters.names.font.name=Arial Narrow Bold
|
||||||
clusters.names.font.name=Arialnb.ttf
|
clusters.names.font.filename=Arialnb.ttf
|
||||||
clusters.names.font.size=7
|
clusters.names.font.size=7
|
||||||
clusters.names.color=7aa2ef
|
clusters.names.color=7aa2ef
|
||||||
clusters.lines.color=8181a9
|
clusters.lines.color=8181a9
|
||||||
@@ -116,7 +117,8 @@ clusters.lines.weight=0.75
|
|||||||
|
|
||||||
# Spheres of Influence
|
# Spheres of Influence
|
||||||
|
|
||||||
sois.font.name=Arialbd.ttf
|
sois.font.name=Arial Bold
|
||||||
|
sois.font.filename=Arialbd.ttf
|
||||||
sois.font.size=16
|
sois.font.size=16
|
||||||
sois.count=14
|
sois.count=14
|
||||||
|
|
||||||
|
|||||||
+13
-30
@@ -187,6 +187,7 @@ typedef struct
|
|||||||
soi_t* sois;
|
soi_t* sois;
|
||||||
int csois;
|
int csois;
|
||||||
const char* soifont;
|
const char* soifont;
|
||||||
|
const char* soifontfile;
|
||||||
double soifontsize;
|
double soifontsize;
|
||||||
|
|
||||||
object_t* objs;
|
object_t* objs;
|
||||||
@@ -295,35 +296,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
drv->drawFilledRect(NULL, scr.backclr);
|
drv->drawFilledRect(NULL, scr.backclr);
|
||||||
|
|
||||||
#if 0
|
|
||||||
drawSpheres(drv, &scr);
|
|
||||||
drawGrid(drv, &scr);
|
|
||||||
drawSphereNames(drv, &scr);
|
|
||||||
drawClusterLines(drv, &scr);
|
|
||||||
drawStars(drv, &scr);
|
|
||||||
drawStarDesignations(drv, &scr);
|
|
||||||
drawClusterNames(drv, &scr);
|
|
||||||
#endif
|
|
||||||
drawLayers(drv, &scr);
|
drawLayers(drv, &scr);
|
||||||
|
|
||||||
|
ret = drv->write();
|
||||||
#if 0
|
if (ret)
|
||||||
{
|
{
|
||||||
int w = 7;
|
mg_verbose(1, "Driver could not write to the device\n");
|
||||||
void drawLine(SDL_Surface* dst, int x0, int y0, int x1, int y1, Uint32 color, int weight);
|
break;
|
||||||
|
|
||||||
drawLine(img, 100, 3500, 150, 3300, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3550, 150, 3490, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3575, 150, 3525, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3600, 200, 3570, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3650, 200, 3680, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3675, 150, 3725, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3700, 150, 3760, 0xffffffff, w);
|
|
||||||
drawLine(img, 100, 3750, 150, 3950, 0xffffffff, w);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
drv->write();
|
|
||||||
drv->end();
|
drv->end();
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
@@ -436,19 +417,20 @@ static int parseFont(mg_font_t* fnt, const char* key)
|
|||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
const char* name;
|
const char* name;
|
||||||
|
const char* filename;
|
||||||
double size;
|
double size;
|
||||||
|
|
||||||
sprintf(buf, "%s.name", key);
|
sprintf(buf, "%s.name", key);
|
||||||
name = scr_GetString(buf);
|
name = scr_GetString(buf);
|
||||||
if (!name)
|
sprintf(buf, "%s.filename", key);
|
||||||
return 0;
|
filename = scr_GetString(buf);
|
||||||
sprintf(buf, "%s.size", key);
|
sprintf(buf, "%s.size", key);
|
||||||
size = scr_GetFloatDef(buf, 10) / 64.0;
|
size = scr_GetFloatDef(buf, 10) / 64.0;
|
||||||
|
|
||||||
*fnt = drv->loadFont(name, size, name);
|
*fnt = drv->loadFont(name, size, filename);
|
||||||
|
|
||||||
if (!*fnt)
|
if (!*fnt)
|
||||||
mg_verbose(1, "Warning: cannot load font '%s'\n", name);
|
mg_verbose(1, "Warning: cannot load font '%s' (%s)\n", name, filename);
|
||||||
|
|
||||||
return *fnt != NULL;
|
return *fnt != NULL;
|
||||||
}
|
}
|
||||||
@@ -980,9 +962,9 @@ static soi_t* loadSois(const char* key, int count, script_t* scr)
|
|||||||
soi->radius = scr_GetFloatDef(buf, 0);
|
soi->radius = scr_GetFloatDef(buf, 0);
|
||||||
sprintf(buf, "%s.%d.%s", key, i, "font.size");
|
sprintf(buf, "%s.%d.%s", key, i, "font.size");
|
||||||
fntsize = scr_GetFloatDef(buf, scr->soifontsize) / 64.0;
|
fntsize = scr_GetFloatDef(buf, scr->soifontsize) / 64.0;
|
||||||
soi->font = drv->loadFont(scr->soifont, fntsize, scr->soifont);
|
soi->font = drv->loadFont(scr->soifont, fntsize, scr->soifontfile);
|
||||||
if (!soi->font)
|
if (!soi->font)
|
||||||
mg_verbose(1, "Warning: cannot load font '%s'\n", scr->soifont);
|
mg_verbose(1, "Warning: cannot load font '%s' (%s)\n", scr->soifont, scr->soifontfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tab;
|
return tab;
|
||||||
@@ -1048,6 +1030,7 @@ static int readScript(script_t* scr, FILE* f)
|
|||||||
|
|
||||||
scr->csois = scr_GetIntegerDef("sois.count", 0);
|
scr->csois = scr_GetIntegerDef("sois.count", 0);
|
||||||
scr->soifont = scr_GetString("sois.font.name");
|
scr->soifont = scr_GetString("sois.font.name");
|
||||||
|
scr->soifontfile = scr_GetString("sois.font.filename");
|
||||||
scr->soifontsize = scr_GetFloatDef("sois.font.size", 16);
|
scr->soifontsize = scr_GetFloatDef("sois.font.size", 16);
|
||||||
scr->sois = loadSois("sois", scr->csois, scr);
|
scr->sois = loadSois("sois", scr->csois, scr);
|
||||||
|
|
||||||
|
|||||||
@@ -400,11 +400,17 @@ static mg_font_t drv_loadFont(const char* name, double size, const char* filenam
|
|||||||
char buf[512];
|
char buf[512];
|
||||||
struct mg_font* fnt;
|
struct mg_font* fnt;
|
||||||
|
|
||||||
|
if (!filename)
|
||||||
|
{
|
||||||
|
mg_verbose(1, "sdlpng: filename not specified for font '%s'\n", name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
fnt = calloc(1, sizeof(*fnt));
|
fnt = calloc(1, sizeof(*fnt));
|
||||||
if (!fnt)
|
if (!fnt)
|
||||||
return 0;
|
return 0;
|
||||||
fnt->size = inchToPixelsY(size);
|
fnt->size = inchToPixelsY(size);
|
||||||
fnt->name = strcopy(name);
|
fnt->name = strcopy(name ? name : "<Unknown>");
|
||||||
sprintf(buf, "%s/%s", fontdir, filename);
|
sprintf(buf, "%s/%s", fontdir, filename);
|
||||||
fnt->font = TTF_OpenFont(buf, fnt->size);
|
fnt->font = TTF_OpenFont(buf, fnt->size);
|
||||||
if (!fnt->font)
|
if (!fnt->font)
|
||||||
|
|||||||
Reference in New Issue
Block a user