Default font family from code to config file
This commit is contained in:
parent
e8dc4c0ba3
commit
1f405508d4
3 changed files with 9 additions and 6 deletions
|
@ -10,4 +10,5 @@ world_bnd_path = /home/gis/mapnik/world_boundaries/
|
|||
cleantopo_dem_path = /raid/srtm/Full/CleanTOPO2merc.tif
|
||||
srtm_dem_path = /raid/srtm/srtmm.vrt
|
||||
cleantopo_hs_path = /raid/srtm/Full/CleanTOPO2merchs.tif
|
||||
srtm_hs_path = /raid/srtm/srtmhs.vrt
|
||||
srtm_hs_path = /raid/srtm/srtmhs.vrt
|
||||
default_font_family = DejaVu Sans Book
|
|
@ -124,6 +124,7 @@ if options.renderer == "mapnik":
|
|||
libkomapnik.cleantopo_hs_path = config.get("mapnik", "cleantopo_hs_path")
|
||||
libkomapnik.srtm_hs_path = config.get("mapnik", "srtm_hs_path")
|
||||
libkomapnik.text_scale = options.textscale
|
||||
libkomapnik.default_font_family = config.get("mapnik", "default_font_family")
|
||||
|
||||
from libkomapnik import *
|
||||
|
||||
|
@ -204,7 +205,7 @@ if options.renderer == "mapnik":
|
|||
|
||||
chooser_entry["sql"] = sq
|
||||
chooser_entry["style"] = styles
|
||||
fonts.add(styles.get("font-family", "DejaVu Sans Book"))
|
||||
fonts.add(styles.get("font-family", libkomapnik.default_font_family))
|
||||
|
||||
chooser_entry["rule"] = [i.conditions for i in chooser.ruleChains if i.test_zoom(zoom)]
|
||||
numerics.update(chooser.get_numerics())
|
||||
|
@ -672,7 +673,7 @@ if options.renderer == "mapnik":
|
|||
if "shield-text" in entry["style"] and "shield-image" in entry["style"]:
|
||||
ttext = entry["style"]["shield-text"].extract_tags().pop()
|
||||
texttags.add(ttext)
|
||||
tface = entry["style"].get("shield-font-family", "DejaVu Sans Book")
|
||||
tface = entry["style"].get("shield-font-family", libkomapnik.default_font_family)
|
||||
tsize = entry["style"].get("shield-font-size", "10")
|
||||
tcolor = entry["style"].get("shield-text-color", "#000000")
|
||||
toverlap = entry["style"].get("text-allow-overlap", entry["style"].get("allow-overlap", "false"))
|
||||
|
@ -701,7 +702,7 @@ if options.renderer == "mapnik":
|
|||
if "text" in entry["style"] and entry["style"].get("text-position", "center") == placement:
|
||||
ttext = entry["style"]["text"].extract_tags().pop()
|
||||
texttags.add(ttext)
|
||||
tface = entry["style"].get("font-family", "DejaVu Sans Book")
|
||||
tface = entry["style"].get("font-family", libkomapnik.default_font_family)
|
||||
tsize = entry["style"].get("font-size", "10")
|
||||
tcolor = entry["style"].get("text-color", "#000000")
|
||||
thcolor = entry["style"].get("text-halo-color", "#ffffff")
|
||||
|
|
|
@ -36,6 +36,7 @@ srtm_dem_path = ""
|
|||
cleantopo_hs_path = ""
|
||||
srtm_hs_path = ""
|
||||
text_scale = 1
|
||||
default_font_family = ""
|
||||
|
||||
substyles = []
|
||||
|
||||
|
@ -132,7 +133,7 @@ def xml_linepatternsymbolizer(file=""):
|
|||
|
||||
|
||||
def xml_textsymbolizer(
|
||||
text="name", face="DejaVu Sans Book", size="10", color="#000000", halo_color="#ffffff", halo_radius="0", placement="line", offset="0", overlap="false", distance="26", wrap_width=256, align="center", opacity="1", pos="X", transform="none", spacing="4096"):
|
||||
text="name", face=default_font_family, size="10", color="#000000", halo_color="#ffffff", halo_radius="0", placement="line", offset="0", overlap="false", distance="26", wrap_width=256, align="center", opacity="1", pos="X", transform="none", spacing="4096"):
|
||||
color = nicecolor(color)
|
||||
halo_color = nicecolor(halo_color)
|
||||
pos = pos.replace("exact", "X").replace("any", "S, E, X, N, W, NE, SE, NW, SW").split(",")
|
||||
|
@ -154,7 +155,7 @@ def xml_textsymbolizer(
|
|||
|
||||
|
||||
def xml_shieldsymbolizer(path="", width="", height="",
|
||||
text="name", face="DejaVu Sans Book", size="10", color="#000000", halo_color="#ffffff", halo_radius="0", placement="line", offset="0", overlap="false", distance="26", wrap_width=256, align="center", opacity="1", transform="none", unlock_image='true', spacing='500'):
|
||||
text="name", face=default_font_family, size="10", color="#000000", halo_color="#ffffff", halo_radius="0", placement="line", offset="0", overlap="false", distance="26", wrap_width=256, align="center", opacity="1", transform="none", unlock_image='true', spacing='500'):
|
||||
color = nicecolor(color)
|
||||
halo_color = nicecolor(halo_color)
|
||||
placement = {"center": "point"}.get(placement.lower(), placement)
|
||||
|
|
Loading…
Add table
Reference in a new issue