diff --git a/doc/examples/charts-basic/custom_font.clp b/doc/examples/charts-basic/custom_font.clp
index b8e13f66a..518917d32 100644
--- a/doc/examples/charts-basic/custom_font.clp
+++ b/doc/examples/charts-basic/custom_font.clp
@@ -1,30 +1,24 @@
-(width 2048px)
-(height 512px)
-(dpi 240)
+(layer/resize 2048px 512px)
+(layer/set-dpi 240)
+(layer/set-font "Comic Sans MS")
-(font "Comic Sans MS")
-(limit-x (1404278100 1404299700))
-(limit-y (0 120))
-
-(axes
- position (bottom left)
- label-format-y (fixed 2)
- label-format-x (datetime "%H:%M:%S")
- label-placement-x (linear 2400)
- label-placement-y (linear 20))
-
-;; (draw/rectangle fill #f2f2f2)
-
-(grid
- color #fff)
-
-(lines
- data-x (csv "test/testdata/measurement.csv" time)
- data-y (csv "test/testdata/measurement.csv" value2))
-
-(legend
- position (top right)
- border none
- margin 0.5em
- item-flow on
- item (label "A very serious measurement"))
+(tools/plotgen
+ limit-x (1404278100 1404299700)
+ limit-y (0 120)
+ grid (
+ color #fff)
+ axes (
+ position (bottom left)
+ label-format-y (fixed 2)
+ label-format-x (datetime "%H:%M:%S")
+ label-placement-x (linear 2400)
+ label-placement-y (linear 20))
+ lines (
+ data-x (csv "test/testdata/measurement.csv" time)
+ data-y (csv "test/testdata/measurement.csv" value2))
+ legend (
+ position (top right)
+ border none
+ margin 0.5em
+ item-flow on
+ item (label "A very serious measurement")))
diff --git a/doc/examples/charts-basic/custom_font.svg b/doc/examples/charts-basic/custom_font.svg
index dcd395b48..60a388ddb 100644
--- a/doc/examples/charts-basic/custom_font.svg
+++ b/doc/examples/charts-basic/custom_font.svg
@@ -2,6 +2,28 @@
\ No newline at end of file
diff --git a/doc/examples/maps/gulf-of-mexico.clp b/doc/examples/maps/gulf-of-mexico.clp
index a646e677a..1e7ff7289 100644
--- a/doc/examples/maps/gulf-of-mexico.clp
+++ b/doc/examples/maps/gulf-of-mexico.clp
@@ -9,7 +9,7 @@
label-placement-y (linear 1)
title-bottom "Longitude"
title-left "Lattitude")
- background fill
+ background (fill #eff7fe)
grid (
tick-placement-x (linear 5)
tick-placement-y (linear 5)
diff --git a/doc/examples/maps/gulf-of-mexico.svg b/doc/examples/maps/gulf-of-mexico.svg
index a0e480dcc..e2e3fdcee 100644
--- a/doc/examples/maps/gulf-of-mexico.svg
+++ b/doc/examples/maps/gulf-of-mexico.svg
@@ -106,80 +106,80 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Gulf of Mexico
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gulf of Mexico
\ No newline at end of file
diff --git a/doc/examples/maps/submarine-cables.clp b/doc/examples/maps/submarine-cables.clp
deleted file mode 100644
index facc7778d..000000000
--- a/doc/examples/maps/submarine-cables.clp
+++ /dev/null
@@ -1,31 +0,0 @@
-(width 2048px)
-(height 1200px)
-(dpi 220)
-
-(default limit-x (-180 180))
-(default limit-y (-80 100))
-
-(draw/rectangle
- fill #f9f9f9)
-
-(plot/grid
- tick-placement-x (linear 10)
- tick-placement-y (none)
- color (rgba 0 0 0 .1)
- stroke-style (dashed)
- stroke-width .5pt)
-
-(plot/lines
- data (geojson /home/paul/downloads/mapex/submarine_cables.geojson)
- stroke-color #666
- stroke-width .5pt)
-
-(plot/polygons
- data (geojson /home/paul/downloads/mapex/world.geojson)
- fill #e8e8e8
- stroke-color #bbb
- stroke-width .2pt)
-
-(figure/legend
- item (label "Submarine cables"))
-
diff --git a/src/layer.cc b/src/layer.cc
index 3443b5cb9..d836fa0b4 100644
--- a/src/layer.cc
+++ b/src/layer.cc
@@ -151,17 +151,18 @@ void layer_set_font(
ReturnCode layer_set_font(
Context* ctx,
const Expr* expr) {
+ auto layer = layer_get(ctx);
+
auto args = expr_collect(expr);
if (args.size() != 1) {
return err_invalid_nargs(args.size(), 1);
}
FontInfo font;
- if (auto rc = expr_call_string(args[0], bind(&font_load_best, _1, &font)); !rc) {
+ if (auto rc = expr_call_string(args[0], bind(&font_load_best, _1, &layer->font)); !rc) {
return rc;
}
- layer_set_font(layer_get(ctx), std::move(font));
return OK;
}
diff --git a/src/plot/plotgen.cc b/src/plot/plotgen.cc
index 78dc06b24..31c66a343 100644
--- a/src/plot/plotgen.cc
+++ b/src/plot/plotgen.cc
@@ -115,7 +115,7 @@ ReturnCode plot_set_background(
stroke_style.line_width = from_pt(1);
/* read arguments */
- auto config_rc = expr_walk_map(expr, {
+ auto config_rc = expr_walk_map_wrapped(expr, {
{
"color",
expr_calln_fn({
diff --git a/test/examples/charts_basic_custom_font.clp b/test/examples/charts_basic_custom_font.clp
index b8e13f66a..518917d32 100644
--- a/test/examples/charts_basic_custom_font.clp
+++ b/test/examples/charts_basic_custom_font.clp
@@ -1,30 +1,24 @@
-(width 2048px)
-(height 512px)
-(dpi 240)
+(layer/resize 2048px 512px)
+(layer/set-dpi 240)
+(layer/set-font "Comic Sans MS")
-(font "Comic Sans MS")
-(limit-x (1404278100 1404299700))
-(limit-y (0 120))
-
-(axes
- position (bottom left)
- label-format-y (fixed 2)
- label-format-x (datetime "%H:%M:%S")
- label-placement-x (linear 2400)
- label-placement-y (linear 20))
-
-;; (draw/rectangle fill #f2f2f2)
-
-(grid
- color #fff)
-
-(lines
- data-x (csv "test/testdata/measurement.csv" time)
- data-y (csv "test/testdata/measurement.csv" value2))
-
-(legend
- position (top right)
- border none
- margin 0.5em
- item-flow on
- item (label "A very serious measurement"))
+(tools/plotgen
+ limit-x (1404278100 1404299700)
+ limit-y (0 120)
+ grid (
+ color #fff)
+ axes (
+ position (bottom left)
+ label-format-y (fixed 2)
+ label-format-x (datetime "%H:%M:%S")
+ label-placement-x (linear 2400)
+ label-placement-y (linear 20))
+ lines (
+ data-x (csv "test/testdata/measurement.csv" time)
+ data-y (csv "test/testdata/measurement.csv" value2))
+ legend (
+ position (top right)
+ border none
+ margin 0.5em
+ item-flow on
+ item (label "A very serious measurement")))
diff --git a/test/examples/charts_basic_custom_font.svg b/test/examples/charts_basic_custom_font.svg
index 81252aec1..60a388ddb 100644
--- a/test/examples/charts_basic_custom_font.svg
+++ b/test/examples/charts_basic_custom_font.svg
@@ -2,17 +2,38 @@