Currently, it's impossible to scale sizes specified with in px-units, e.g.: text-size: 13 will be always 13 at any dpi/ppi. While this is similar to how browsers treat px-sizes (at least before retina-displays era), for maps this would mean that scaling is not possible at all.
What I suggest is to consider a change which would allow for px-scaling. A quick patch:
diff --git a/lib/carto/tree/dimension.js b/lib/carto/tree/dimension.js
index 07232f2..7d762ee 100644
--- a/lib/carto/tree/dimension.js
+++ b/lib/carto/tree/dimension.js
@@ -11,7 +11,7 @@ tree.Dimension = function Dimension(value, unit, index) {
tree.Dimension.prototype = {
is: 'float',
- physical_units: ['m', 'cm', 'in', 'mm', 'pt', 'pc'],
+ physical_units: ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px'],
screen_units: ['px', '%'],
all_units: ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'],
densities: {
@@ -19,7 +19,8 @@ tree.Dimension.prototype = {
mm: 25.4,
cm: 2.54,
pt: 72,
- pc: 6
+ pc: 6,
+ px: 90.714 // the same as the default ppi
},
ev: function (env) {
if (this.unit && !_.contains(this.all_units, this.unit)) {
This behavior is not necessary to trigger by default, instead a command-line switch can be added.
Thoughts?