add more visible tracks

add more visible tracks

/* Roads, footpaths, tracks */

@private_road_colour: #c02c34;

@tertiary_road_colour:  #faf555;
@secondary_road_colour: #d46833;
@primary_road_colour:   #cc3737;
@trunk_road_colour:     #650f0d;
@motorway_road_colour:  #7c0046;

/* paths (footway, cycleway, track) are dotted, the halo is behind the
   dots */
@path_halo_opacity: 0.3;
@path_halo_colour: white;
@path_dot_opacity: 1.0;

/* highway labels */
@highway_face_name: "Liberation Sans Regular";
@highway_text_fill: white;
@highway_halo_fill: black;
@highway_halo_radius: 2.0;

/*
  service      black
  residential  black
  unclassified black
  tertiary     yellow
  secondary    orange
  primary      red
  trunk        blue
  motorway     dark red
*/

#highway-labels[highway='footway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='cycleway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='path'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='track'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

#highway-labels[highway='service'][zoom > 16] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='residential'][zoom > 15] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='unclassified'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='tertiary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='secondary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='primary'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='trunk'][zoom > 12] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='motorway'][zoom > 11] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

/* default style for all path, footway, track, cycleways and roads */
.highway[zoom > 12] {
  line-color: #000000;
  line-opacity: 0.5;
  line-join: round;
  line-cap: round;

  line-width: 1;
}

/* defaults for roads with cars */
.road[zoom > 11] {
  ::oneway_arrow[oneway='yes'][zoom > 14] {
    marker-type: arrow;

    marker-width: 2;
    marker-line-width: 2;

    marker-opacity: 1.0;
    marker-line-opacity: 1.0;

    marker-fill: white;
    marker-line-color: white;

    marker-spacing: 100;
  }

  line-color: #000000;
  line-join: round;
  line-cap: round;

  line-width: 1;

  [zoom > 17] { line-width: 15; line-opacity: 0.5; }
  [zoom = 17] { line-width: 10; line-opacity: 0.5; }
  [zoom = 16] { line-width: 5; line-opacity: 0.5; }
  [zoom = 15] { line-width: 2.25; line-opacity: 0.6; }
  [zoom = 14] { line-width: 1.5; line-opacity: 0.7; }
  [zoom = 13] { line-width: 1; line-opacity: 0.8; }
  [zoom = 12] { line-width: 0.5; line-opacity: 0.8; }

  ::bridge[bridge='yes'] {
    /*
    ideally we would draw two lines outside the existing line,
    but the current compositing method in mapnik won't allow this
    so easily with transparency

    line-color: #000000;
    line-opacity: 0.5;
    line-join: round;
    line-cap: round;

    [zoom > 17] { line-width: 20; }
    [zoom = 17] { line-width: 15; }
    [zoom = 16] { line-width: 7; }
    [zoom = 15] { line-width: 3; }
    [zoom = 14] { line-width: 2; }
    [zoom = 13] { line-width: 1.5; }
    [zoom = 12] { line-width: 0.75; }
    */
  }

  [tunnel='yes'] {
    [zoom > 17] { line-dasharray: 6,6; }
    [zoom = 17] { line-dasharray: 4.5,4.5; }
    [zoom < 17] { line-dasharray: 3,3; }
  	line-cap: butt;
  }

}

.highway#footway[zoom > 13] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #FF0000;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

  [highway='steps']{
    line-cap: butt;

    [zoom > 18] { line-dasharray: 3,4 }
    [zoom = 18] { line-dasharray: 2,3 }
    [zoom < 18] { line-dasharray: 1,2 }
  }

}

.highway#path[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }
  line-color: #000000;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

}

.highway#track[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: 0.7;

    [zoom > 18] { line-width: 16; line-opacity: @path_halo_opacity; }
    [zoom = 18] { line-width: 10; line-opacity: @path_halo_opacity; }
    [zoom = 17] { line-width: 6; }
    [zoom = 16] { line-width: 4.5; }
    [zoom = 15] { line-width: 3.2 }
    [zoom = 14] { line-width: 2.5 }
    [zoom = 13] { line-width: 2 }
  }

  ::dottedline{
	  line-color: #6d4f15;
	  line-opacity: @path_dot_opacity;

	  [zoom > 18] { line-width: 8  ; line-dasharray: 16,16 }
	  [zoom = 18] { line-width: 5  ; line-dasharray: 8,8 }
	  [zoom = 17] { line-width: 3  ; line-dasharray: 6,6 }
	  [zoom = 16] { line-width: 2.1; line-dasharray: 4,4 }
	  [zoom = 15] { line-width: 1.8; line-dasharray: 4,4 }
	  [zoom = 14] { line-width: 1.5; line-dasharray: 4,4 }
	  [zoom = 13] { line-width: 1.2  ; line-dasharray: 4,4 }
  }
}

.highway#cycleway[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #0000ff;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

}

.road#service[zoom > 11] {
  [zoom > 17] { line-width: 7.5; }
  [zoom = 17] { line-width: 5; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 0.75; }
  [zoom = 13] { line-width: 0.5; }
  [zoom = 12] { line-width: 0.25; }

  [service='parking_aisle'][zoom > 14] {
    [zoom > 17] { line-width: 3; }
    [zoom = 17] { line-width: 2.5; }
    [zoom = 16] { line-width: 1.25; }
    [zoom = 15] { line-width: 0.25; }
  }

  ::private[access='private'],[access='no'],[access='permissive'],[access='customer'],[access='delivery'] {
    line-cap: butt;
    line-dasharray: 6,6;
    line-color: @private_road_colour;
    line-opacity: 0.5;

    [zoom > 17] { line-width: 7.5; }
    [zoom = 17] { line-width: 5; }
    [zoom = 16] { line-width: 2.5; }
    [zoom = 15] { line-width: 1; }
    [zoom = 14] { line-width: 0.75; }
    [zoom = 13] { line-width: 0.5; }
    [zoom = 12] { line-width: 0.25; }
  }
}

.road#residential[zoom > 11] {
  ::living_street[highway='living_street'][zoom > 14] {
    line-cap: round;
    [zoom > 17] { line-dasharray: 6,24; }
    [zoom = 17] { line-dasharray: 3,12; }
    [zoom < 17] { line-dasharray: 6,12; }
    line-color: #76d276;
    line-opacity: 0.3;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  ::private[access='private'],[access='no'],[access='permissive'],[access='customer'],[access='delivery'] {
    line-cap: round;
    [zoom > 17] { line-dasharray: 6,24; }
    [zoom = 17] { line-dasharray: 3,12; }
    [zoom < 17] { line-dasharray: 6,12; }
    line-color: @private_road_colour;
    line-opacity: 0.3;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  [zoom > 17] { line-width: 10; }
  [zoom = 17] { line-width: 7.5; }
  [zoom = 16] { line-width: 3.5; }
  [zoom = 15] { line-width: 1.75; }
  [zoom = 14] { line-width: 1; }
  [zoom = 13] { line-width: 0.75; }
  [zoom = 12] { line-width: 0.3; }

}

/* sets the colours for the road classification,
  but also draws the default line where .road doesn't apply
  ie. for zoom < 12 */
.road#unclassified{
}

.road#tertiary[zoom > 11] {
  line-color: @tertiary_road_colour;
}

.road#secondary[zoom > 7] {
  line-color: @secondary_road_colour;
  [zoom = 12] { line-width: 1.0}
}

.road#primary[zoom > 6] {
  line-color: @primary_road_colour;
  [zoom = 12] { line-width: 1.5}
}

.road#trunk[zoom > 5] {
  line-color: @trunk_road_colour;

  [zoom = 15] { line-width: 3; }
  [zoom = 14] { line-width: 2.75; }
  [zoom = 13] { line-width: 2.5; }
  [zoom = 12] { line-width: 2.0; }
  [zoom = 11] { line-width: 1.25; }
}

.road#motorway[zoom > 4] {
  line-color: @motorway_road_colour;

  /* keep in mind that most motorways are dual-carraige ways, and
     the current mapnik/osm2pgsql doesn't combine these into one
     for low zooms */

  [zoom = 16] { line-width: 6; }
  [zoom = 15] { line-width: 4; }
  [zoom = 14] { line-width: 3; }
  [zoom = 13] { line-width: 2.5; }
  [zoom = 12] { line-width: 2.0; }
  [zoom = 11] { line-width: 1.75; }
  [zoom = 10] { line-width: 1.5; }
}

/* Roads, footpaths, tracks */

@private_road_colour: #c02c34;

@tertiary_road_colour:  #faf555;
@secondary_road_colour: #d46833;
@primary_road_colour:   #cc3737;
@trunk_road_colour:     #650f0d;
@motorway_road_colour:  #7c0046;

/* paths (footway, cycleway, track) are dotted, the halo is behind the
   dots */
@path_halo_opacity: 0.3;
@path_halo_colour: white;
@path_dot_opacity: 1.0;

/* highway labels */
@highway_face_name: "Liberation Sans Regular";
@highway_text_fill: white;
@highway_halo_fill: black;
@highway_halo_radius: 2.0;

/*
  service      black
  residential  black
  unclassified black
  tertiary     yellow
  secondary    orange
  primary      red
  trunk        blue
  motorway     dark red
*/

#highway-labels[highway='footway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='cycleway'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='path'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='track'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

#highway-labels[highway='service'][zoom > 16] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='residential'][zoom > 15] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='unclassified'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='tertiary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='secondary'][zoom > 14] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='primary'][zoom > 13] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='trunk'][zoom > 12] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}
#highway-labels[highway='motorway'][zoom > 11] {
  text-name: "[name]";
  text-face-name: @highway_face_name;
  text-fill: @highway_text_fill;
  text-placement: line;
  text-halo-fill: @highway_halo_fill;
  text-halo-radius: @highway_halo_radius;

  [zoom > 21] { text-size: 30; }
  [zoom = 21] { text-size: 25; }
  [zoom = 20] { text-size: 20; }
  [zoom = 19] { text-size: 15; }
  [zoom = 18] { text-size: 13; }
  [zoom = 17] { text-size: 12; }
  [zoom = 16] { text-size: 11; }
  [zoom = 15] { text-size: 11; }
  [zoom = 14] { text-size: 10; }
  [zoom = 13] { text-size: 8; }
  [zoom = 12] {text-size: 8; }
}

/* default style for all path, footway, track, cycleways and roads */
.highway[zoom > 12] {
  line-color: #000000;
  line-opacity: 0.5;
  line-join: round;
  line-cap: round;

  line-width: 1;
}

/* defaults for roads with cars */
.road[zoom > 11] {
  ::oneway_arrow[oneway='yes'][zoom > 14] {
    marker-type: arrow;

    marker-width: 2;
    marker-line-width: 2;

    marker-opacity: 1.0;
    marker-line-opacity: 1.0;

    marker-fill: white;
    marker-line-color: white;

    marker-spacing: 100;
  }

  line-color: #000000;
  line-join: round;
  line-cap: round;

  line-width: 1;

  [zoom > 17] { line-width: 15; line-opacity: 0.5; }
  [zoom = 17] { line-width: 10; line-opacity: 0.5; }
  [zoom = 16] { line-width: 5; line-opacity: 0.5; }
  [zoom = 15] { line-width: 2.25; line-opacity: 0.6; }
  [zoom = 14] { line-width: 1.5; line-opacity: 0.7; }
  [zoom = 13] { line-width: 1; line-opacity: 0.8; }
  [zoom = 12] { line-width: 0.5; line-opacity: 0.8; }

  ::bridge[bridge='yes'] {
    /*
    ideally we would draw two lines outside the existing line,
    but the current compositing method in mapnik won't allow this
    so easily with transparency

    line-color: #000000;
    line-opacity: 0.5;
    line-join: round;
    line-cap: round;

    [zoom > 17] { line-width: 20; }
    [zoom = 17] { line-width: 15; }
    [zoom = 16] { line-width: 7; }
    [zoom = 15] { line-width: 3; }
    [zoom = 14] { line-width: 2; }
    [zoom = 13] { line-width: 1.5; }
    [zoom = 12] { line-width: 0.75; }
    */
  }

  [tunnel='yes'] {
    [zoom > 17] { line-dasharray: 6,6; }
    [zoom = 17] { line-dasharray: 4.5,4.5; }
    [zoom < 17] { line-dasharray: 3,3; }
  	line-cap: butt;
  }

}

.highway#footway[zoom > 13] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #FF0000;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

  [highway='steps']{
    line-cap: butt;

    [zoom > 18] { line-dasharray: 3,4 }
    [zoom = 18] { line-dasharray: 2,3 }
    [zoom < 18] { line-dasharray: 1,2 }
  }

}

.highway#path[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }
  line-color: #000000;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

}

.highway#track[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 16 }
    [zoom = 18] { line-width: 10 }
    [zoom = 17] { line-width: 6 }
    [zoom = 16] { line-width: 4.5 }
    [zoom = 15] { line-width: 3.2 }
    [zoom = 14] { line-width: 3 }
    [zoom = 13] { line-width: 2.4 }
  }

  line-color: #6d4f15;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 3,4 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 3,4 }
  [zoom = 16] { line-width: 2.1; line-dasharray: 3,4 }
  [zoom = 15] { line-width: 1.8; line-dasharray: 3,4 }
  [zoom = 14] { line-width: 1.5; line-dasharray: 3,4 }
  [zoom = 13] { line-width: 1.2  ; line-dasharray: 3,4 }

}

.highway#cycleway[zoom > 12] {
  ::halo{
    line-color: @path_halo_colour;
    line-opacity: @path_halo_opacity;

    [zoom > 18] { line-width: 9 }
    [zoom = 18] { line-width: 6 }
    [zoom = 17] { line-width: 4 }
    [zoom < 17] { line-width: 2 }
  }

  line-color: #0000ff;
  line-opacity: @path_dot_opacity;

  [zoom > 18] { line-width: 8  ; line-dasharray: 2,16 }
  [zoom = 18] { line-width: 5  ; line-dasharray: 2,8 }
  [zoom = 17] { line-width: 3  ; line-dasharray: 1,4 }
  [zoom = 16] { line-width: 2  ; line-dasharray: 1,3 }
  [zoom < 16] { line-width: 1.5; line-dasharray: 1,2 }

}

.road#service[zoom > 11] {
  [zoom > 17] { line-width: 7.5; }
  [zoom = 17] { line-width: 5; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 0.75; }
  [zoom = 13] { line-width: 0.5; }
  [zoom = 12] { line-width: 0.25; }

  [service='parking_aisle'][zoom > 14] {
    [zoom > 17] { line-width: 3; }
    [zoom = 17] { line-width: 2.5; }
    [zoom = 16] { line-width: 1.25; }
    [zoom = 15] { line-width: 0.25; }
  }

  ::private[access='private'],[access='no'],[access='permissive'],[access='customer'],[access='delivery'] {
    line-cap: butt;
    line-dasharray: 6,6;
    line-color: @private_road_colour;
    line-opacity: 0.5;

    [zoom > 17] { line-width: 7.5; }
    [zoom = 17] { line-width: 5; }
    [zoom = 16] { line-width: 2.5; }
    [zoom = 15] { line-width: 1; }
    [zoom = 14] { line-width: 0.75; }
    [zoom = 13] { line-width: 0.5; }
    [zoom = 12] { line-width: 0.25; }
  }
}

.road#residential[zoom > 11] {
  ::living_street[highway='living_street'][zoom > 14] {
    line-cap: round;
    [zoom > 17] { line-dasharray: 6,24; }
    [zoom = 17] { line-dasharray: 3,12; }
    [zoom < 17] { line-dasharray: 6,12; }
    line-color: #76d276;
    line-opacity: 0.3;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  ::private[access='private'],[access='no'],[access='permissive'],[access='customer'],[access='delivery'] {
    line-cap: round;
    [zoom > 17] { line-dasharray: 6,24; }
    [zoom = 17] { line-dasharray: 3,12; }
    [zoom < 17] { line-dasharray: 6,12; }
    line-color: @private_road_colour;
    line-opacity: 0.3;

    [zoom > 17] { line-width: 10; }
    [zoom = 17] { line-width: 7.5; }
    [zoom = 16] { line-width: 3.5; }
    [zoom = 15] { line-width: 1.75; }
    [zoom = 14] { line-width: 1; }
    [zoom = 13] { line-width: 0.75; }
    [zoom = 12] { line-width: 0.3; }
  }

  [zoom > 17] { line-width: 10; }
  [zoom = 17] { line-width: 7.5; }
  [zoom = 16] { line-width: 3.5; }
  [zoom = 15] { line-width: 1.75; }
  [zoom = 14] { line-width: 1; }
  [zoom = 13] { line-width: 0.75; }
  [zoom = 12] { line-width: 0.3; }

}

/* sets the colours for the road classification,
  but also draws the default line where .road doesn't apply
  ie. for zoom < 12 */
.road#unclassified{
}

.road#tertiary[zoom > 11] {
  line-color: @tertiary_road_colour;
}

.road#secondary[zoom > 7] {
  line-color: @secondary_road_colour;
  [zoom = 12] { line-width: 1.0}
}

.road#primary[zoom > 6] {
  line-color: @primary_road_colour;
  [zoom = 12] { line-width: 1.5}
}

.road#trunk[zoom > 5] {
  line-color: @trunk_road_colour;

  [zoom = 15] { line-width: 3; }
  [zoom = 14] { line-width: 2.75; }
  [zoom = 13] { line-width: 2.5; }
  [zoom = 12] { line-width: 2.0; }
  [zoom = 11] { line-width: 1.25; }
}

.road#motorway[zoom > 4] {
  line-color: @motorway_road_colour;

  /* keep in mind that most motorways are dual-carraige ways, and
     the current mapnik/osm2pgsql doesn't combine these into one
     for low zooms */

  [zoom = 16] { line-width: 6; }
  [zoom = 15] { line-width: 4; }
  [zoom = 14] { line-width: 3; }
  [zoom = 13] { line-width: 2.5; }
  [zoom = 12] { line-width: 2.0; }
  [zoom = 11] { line-width: 1.75; }
  [zoom = 10] { line-width: 1.5; }
}


Add element parameter to AddControlEventAttributes() interface

function RegisterAvailableExtensions (availableExtensions) {
    //$module(Initialize.mss)
    // Expects and empty TreeNode Hash map object as argument.
    // Looks for existing extensions and registers them in this Hash map.
    // Keys in the Hash map are the names by which the extension plugins can be
    // referenced in ManuScript, e.g. like `@name.SibmeiExtensionAPIVersion`.
    // Values are the full names that are displayed to the user.

    apiSemver = SplitString(ExtensionAPIVersion, '.');
    errors = '';

    for each pluginObject in Sibelius.Plugins
    {
        if (pluginObject.DataExists('SibmeiExtensionAPIVersion'))
        {

            plgName = pluginObject.File.NameNoPath;
            extensionSemver = SplitString(@plgName.SibmeiExtensionAPIVersion, '.');

            switch (true)
            {
                case (extensionSemver.NumChildren != 3)
                {
                    error = 'Extension %s must have a valid semantic versioning string in field `ExtensionAPIVersion`';
                }
                case ((apiSemver[0] = extensionSemver[0]) and (apiSemver[1] >= extensionSemver[1]))
                {
                    error = null;
                }
                case ((apiSemver[0] < extensionSemver[0]) or (apiSemver[1] < extensionSemver[1]))
                {
                    error = 'Extension %s requires Sibmei to be updated to a newer version';
                }
                default
                {
                    error = 'Extension %s needs to be updated to be compatible with the current Sibmei version';
                }
            }

            if (null = error)
            {
                // Storing key/value pairs in old-style Hash TreeNodes needs @-indirection
                availableExtensions.@plgName = pluginObject.Name;
            }
            else
            {
                errors = errors & utils.Format(error, plgName) & '\n';
            }
        }
    }

    return errors;
}  //$end

function ChooseExtensions (availableExtensions, chosenExtensions) {
    // Expects an empty Dictionary as second argument.
    // Runs the ExtensionDialog and stores all extensions the user chose in the
    // Dictionary. Adds key/value pairs in the same way as
    // RegisterAvailableExtensions()
    // Returns true on success, false if the user canceled the dialog.

    if (not Sibelius.ShowDialog(ExtensionDialog, Self))
    {
        return false;
    }
    // Unfortunately, SelectedExtensions only has the selected values from the
    // AvailableExtensions object, i.e. the extension plugin's full user facing
    // name, not the PLG name that we need to reference it in ManuScript.
    extensionIsSelected = CreateDictionary();
    for each fullExtensionName in SelectedExtensions
    {
        extensionIsSelected[fullExtensionName] = true;
    }
    for each extension in AvailableExtensions
    {
        // Cast TreeNode Hash object to its string value
        fullExtensionName = extension & '';
        if (extensionIsSelected[extension])
        {
            plgName = extension.Label;
            chosenExtensions[plgName] = fullExtensionName;
        }
    }

    return true;
}  //$end

function SelectAllExtensions () {
    SelectedExtensions = AvailableExtensions;
    Sibelius.RefreshDialog();
}  //$end

function DeselectAllExtensions () {
    SelectedExtensions = CreateHash();
    Sibelius.RefreshDialog();
}  //$end

function InitExtensions (extensions) {
    // To let the user choose extensions via dialog, pass `null` as argument.
    // If extensions should be activated without showing the  dialog, pass a
    // SparseArray with the 'PLG names' of the extensions, i.e. the names that
    // `RegisterAvailableExtensions()` will use as keys. This is useful e.g.
    // for running tests without requiring user interaction.
    //
    // Returns false if the user aborted the selection of extensions or if there
    // are any errors, otherwise returns true.

    AvailableExtensions = CreateHash();
    errors = RegisterAvailableExtensions(AvailableExtensions);
    if (null != errors)
    {
        Sibelius.MessageBox(errors);
        return false;
    }

    chosenExtensions = CreateDictionary();
    if (null = extensions)
    {
        if (not ChooseExtensions(AvailableExtensions, chosenExtensions))
        {
            return false;
        }
    } else {
        for each plgName in extensions
        {
            // Attention, choose AvailableExtensions with .@
            chosenExtensions[plgName] = AvailableExtensions.@plgName;
        }
    }

    apiObject = CreateApiObject();

    for each Name plgName in chosenExtensions
    {
        @plgName.InitSibmeiExtension(apiObject);
    }

    // store chosenExtensions as global to add application info
    Self._property:ChosenExtensions = chosenExtensions;

    return true;
}  //$end

function CreateApiObject () {
    apiObject = CreateDictionary('libmei', libmei);
    apiObject.SetMethod('RegisterSymbolHandlers', Self, 'ExtensionAPI_RegisterSymbolHandlers');
    apiObject.SetMethod('RegisterTextHandlers', Self, 'ExtensionAPI_RegisterTextHandlers');
    apiObject.SetMethod('MeiFactory', Self, 'ExtensionAPI_MeiFactory');
    apiObject.SetMethod('HandleControlEvent', Self, 'HandleControlEvent');
    apiObject.SetMethod('HandleModifier', Self, 'HandleModifier');
    apiObject.SetMethod('AddFormattedText', Self, 'ExtensionAPI_AddFormattedText');
    apiObject.SetMethod('GenerateControlEvent', Self, 'ExtensionAPI_GenerateControlEvent');
    apiObject.SetMethod('AddControlEventAttributes', Self, 'ExtensionAPI_AddControlEventAttributes');
    return apiObject;
}  //$end

function ExtensionAPI_RegisterSymbolHandlers (this, symbolHandlerDict, plugin) {
    RegisterHandlers(Self._property:SymbolHandlers, symbolHandlerDict, plugin);
}  //$end

function ExtensionAPI_RegisterTextHandlers (this, textHandlerDict, plugin) {
    RegisterHandlers(Self._property:TextHandlers, textHandlerDict, plugin);
}  //$end

function ExtensionAPI_MeiFactory (this, templateObject) {
    MeiFactory(templateObject);
}  //$end

function ExtensionAPI_AddFormattedText (this, parentElement, textObj) {
    AddFormattedText (parentElement, textObj);
}   //$end

function ExtensionAPI_GenerateControlEvent (this, bobj, elementName) {
    GenerateControlEvent(bobj, elementName);
}   //$end

function ExtensionAPI_AddControlEventAttributes (this, bobj, element) {
    AddControlEventAttributes(bobj, element);
}   //$end

function RegisterAvailableExtensions (availableExtensions) {
    //$module(Initialize.mss)
    // Expects and empty TreeNode Hash map object as argument.
    // Looks for existing extensions and registers them in this Hash map.
    // Keys in the Hash map are the names by which the extension plugins can be
    // referenced in ManuScript, e.g. like `@name.SibmeiExtensionAPIVersion`.
    // Values are the full names that are displayed to the user.

    apiSemver = SplitString(ExtensionAPIVersion, '.');
    errors = '';

    for each pluginObject in Sibelius.Plugins
    {
        if (pluginObject.DataExists('SibmeiExtensionAPIVersion'))
        {

            plgName = pluginObject.File.NameNoPath;
            extensionSemver = SplitString(@plgName.SibmeiExtensionAPIVersion, '.');

            switch (true)
            {
                case (extensionSemver.NumChildren != 3)
                {
                    error = 'Extension %s must have a valid semantic versioning string in field `ExtensionAPIVersion`';
                }
                case ((apiSemver[0] = extensionSemver[0]) and (apiSemver[1] >= extensionSemver[1]))
                {
                    error = null;
                }
                case ((apiSemver[0] < extensionSemver[0]) or (apiSemver[1] < extensionSemver[1]))
                {
                    error = 'Extension %s requires Sibmei to be updated to a newer version';
                }
                default
                {
                    error = 'Extension %s needs to be updated to be compatible with the current Sibmei version';
                }
            }

            if (null = error)
            {
                // Storing key/value pairs in old-style Hash TreeNodes needs @-indirection
                availableExtensions.@plgName = pluginObject.Name;
            }
            else
            {
                errors = errors & utils.Format(error, plgName) & '\n';
            }
        }
    }

    return errors;
}  //$end

function ChooseExtensions (availableExtensions, chosenExtensions) {
    // Expects an empty Dictionary as second argument.
    // Runs the ExtensionDialog and stores all extensions the user chose in the
    // Dictionary. Adds key/value pairs in the same way as
    // RegisterAvailableExtensions()
    // Returns true on success, false if the user canceled the dialog.

    if (not Sibelius.ShowDialog(ExtensionDialog, Self))
    {
        return false;
    }
    // Unfortunately, SelectedExtensions only has the selected values from the
    // AvailableExtensions object, i.e. the extension plugin's full user facing
    // name, not the PLG name that we need to reference it in ManuScript.
    extensionIsSelected = CreateDictionary();
    for each fullExtensionName in SelectedExtensions
    {
        extensionIsSelected[fullExtensionName] = true;
    }
    for each extension in AvailableExtensions
    {
        // Cast TreeNode Hash object to its string value
        fullExtensionName = extension & '';
        if (extensionIsSelected[extension])
        {
            plgName = extension.Label;
            chosenExtensions[plgName] = fullExtensionName;
        }
    }

    return true;
}  //$end

function SelectAllExtensions () {
    SelectedExtensions = AvailableExtensions;
    Sibelius.RefreshDialog();
}  //$end

function DeselectAllExtensions () {
    SelectedExtensions = CreateHash();
    Sibelius.RefreshDialog();
}  //$end

function InitExtensions (extensions) {
    // To let the user choose extensions via dialog, pass `null` as argument.
    // If extensions should be activated without showing the  dialog, pass a
    // SparseArray with the 'PLG names' of the extensions, i.e. the names that
    // `RegisterAvailableExtensions()` will use as keys. This is useful e.g.
    // for running tests without requiring user interaction.
    //
    // Returns false if the user aborted the selection of extensions or if there
    // are any errors, otherwise returns true.

    AvailableExtensions = CreateHash();
    errors = RegisterAvailableExtensions(AvailableExtensions);
    if (null != errors)
    {
        Sibelius.MessageBox(errors);
        return false;
    }

    chosenExtensions = CreateDictionary();
    if (null = extensions)
    {
        if (not ChooseExtensions(AvailableExtensions, chosenExtensions))
        {
            return false;
        }
    } else {
        for each plgName in extensions
        {
            // Attention, choose AvailableExtensions with .@
            chosenExtensions[plgName] = AvailableExtensions.@plgName;
        }
    }

    apiObject = CreateApiObject();

    for each Name plgName in chosenExtensions
    {
        @plgName.InitSibmeiExtension(apiObject);
    }

    // store chosenExtensions as global to add application info
    Self._property:ChosenExtensions = chosenExtensions;

    return true;
}  //$end

function CreateApiObject () {
    apiObject = CreateDictionary('libmei', libmei);
    apiObject.SetMethod('RegisterSymbolHandlers', Self, 'ExtensionAPI_RegisterSymbolHandlers');
    apiObject.SetMethod('RegisterTextHandlers', Self, 'ExtensionAPI_RegisterTextHandlers');
    apiObject.SetMethod('MeiFactory', Self, 'ExtensionAPI_MeiFactory');
    apiObject.SetMethod('HandleControlEvent', Self, 'HandleControlEvent');
    apiObject.SetMethod('HandleModifier', Self, 'HandleModifier');
    apiObject.SetMethod('AddFormattedText', Self, 'ExtensionAPI_AddFormattedText');
    apiObject.SetMethod('GenerateControlEvent', Self, 'ExtensionAPI_GenerateControlEvent');
    apiObject.SetMethod('AddControlEventAttributes', Self, 'ExtensionAPI_AddControlEventAttributes');
    return apiObject;
}  //$end

function ExtensionAPI_RegisterSymbolHandlers (this, symbolHandlerDict, plugin) {
    RegisterHandlers(Self._property:SymbolHandlers, symbolHandlerDict, plugin);
}  //$end

function ExtensionAPI_RegisterTextHandlers (this, textHandlerDict, plugin) {
    RegisterHandlers(Self._property:TextHandlers, textHandlerDict, plugin);
}  //$end

function ExtensionAPI_MeiFactory (this, templateObject) {
    MeiFactory(templateObject);
}  //$end

function ExtensionAPI_AddFormattedText (this, parentElement, textObj) {
    AddFormattedText (parentElement, textObj);
}   //$end

function ExtensionAPI_GenerateControlEvent (this, bobj, elementName) {
    GenerateControlEvent(bobj, elementName);
}   //$end

function ExtensionAPI_AddControlEventAttributes (this, bobj) {
    AddControlEventAttributes(bobj);
}   //$end


need a zoom filter to prevent a generic point drawn

#railway-line[railway='rail'][zoom > 11] {
  line-opacity: 0.5;
  line-color: #AAAAAA;

  [zoom > 17] { line-width: 5; }
  [zoom = 17] { line-width: 3; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 1;  line-opacity: 0.9 }
  [zoom = 13] { line-width: 1; line-opacity: 0.9 }
  [zoom = 12] { line-width: 0.25;  line-opacity: 0.9  }

  /* the dotted part */
  ::track{
    line-opacity: 0.75;
    line-color: #000000;
    line-cap: butt;
    line-dasharray: 3,4;

    [zoom > 17] { line-width: 5; }
    [zoom = 17] { line-width: 3; }
    [zoom = 16] { line-width: 2.5; }
    [zoom = 15] { line-width: 1; }
    [zoom = 14] { line-width: 0.75; }
    [zoom = 13] { line-width: 0.5; }
    [zoom = 12] { line-width: 0.25; }
  }
}

#railway-station {
  ::label[zoom > 13]{
    text-name: "[name]";
    text-face-name: "Liberation Sans Bold";
    text-fill: #AC39AC;
    text-placement: point;
    text-allow-overlap: true;
    text-halo-fill: white;
    text-halo-radius: 1.0;

    [zoom > 16] { text-dy: -15; }
    [zoom = 16] { text-dy: -10; }
    [zoom = 15] { text-dy: -8; }
    [zoom = 14] { text-dy: -6; }

    [zoom > 21] { text-size: 30; }
    [zoom = 21] { text-size: 25; }
    [zoom = 20] { text-size: 20; }
    [zoom = 19] { text-size: 15; }
    [zoom = 18] { text-size: 13; }
    [zoom = 17] { text-size: 12; }
    [zoom = 16] { text-size: 11; }
    [zoom = 15] { text-size: 11; }
    [zoom = 14] { text-size: 10; }
  }

  ::dot[zoom > 11]{
    point-allow-overlap: true;

    [zoom > 16] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.24.png');
    }
    [zoom = 16] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.20.png');
    }
    [zoom = 15] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.16.png');
    }
    [zoom = 14],[zoom = 13],[zoom = 12] {
      point-file: url('/usr/share/icons/osmt/station-dot.png');
      point-opacity: 0.75;
    }
  }
}

#railway-line[railway='rail'][zoom > 11] {
  line-opacity: 0.5;
  line-color: #AAAAAA;

  [zoom > 17] { line-width: 5; }
  [zoom = 17] { line-width: 3; }
  [zoom = 16] { line-width: 2.5; }
  [zoom = 15] { line-width: 1; }
  [zoom = 14] { line-width: 1;  line-opacity: 0.9 }
  [zoom = 13] { line-width: 1; line-opacity: 0.9 }
  [zoom = 12] { line-width: 0.25;  line-opacity: 0.9  }

  /* the dotted part */
  ::track{
    line-opacity: 0.75;
    line-color: #000000;
    line-cap: butt;
    line-dasharray: 3,4;

    [zoom > 17] { line-width: 5; }
    [zoom = 17] { line-width: 3; }
    [zoom = 16] { line-width: 2.5; }
    [zoom = 15] { line-width: 1; }
    [zoom = 14] { line-width: 0.75; }
    [zoom = 13] { line-width: 0.5; }
    [zoom = 12] { line-width: 0.25; }
  }
}

#railway-station {
  ::label[zoom > 13]{
    text-name: "[name]";
    text-face-name: "Liberation Sans Bold";
    text-fill: #AC39AC;
    text-placement: point;
    text-allow-overlap: true;
    text-halo-fill: white;
    text-halo-radius: 1.0;

    [zoom > 16] { text-dy: -15; }
    [zoom = 16] { text-dy: -10; }
    [zoom = 15] { text-dy: -8; }
    [zoom = 14] { text-dy: -6; }

    [zoom > 21] { text-size: 30; }
    [zoom = 21] { text-size: 25; }
    [zoom = 20] { text-size: 20; }
    [zoom = 19] { text-size: 15; }
    [zoom = 18] { text-size: 13; }
    [zoom = 17] { text-size: 12; }
    [zoom = 16] { text-size: 11; }
    [zoom = 15] { text-size: 11; }
    [zoom = 14] { text-size: 10; }
  }

  ::dot{
    point-allow-overlap: true;

    [zoom > 16] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.24.png');
    }
    [zoom = 16] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.20.png');
    }
    [zoom = 15] {
      point-file: url('/usr/share/icons/sjjb/png/transport/train_station.glow.AC39AC.16.png');
    }
    [zoom = 14],[zoom = 13],[zoom = 12] {
      point-file: url('/usr/share/icons/osmt/station-dot.png');
      point-opacity: 0.75;
    }
  }
}


abuse the natural earth changed property to blacklist water bodies with accents

@text_font_transport_bold: 'Arial Unicode MS Bold';
@text_font_physical_bold: 'Arial Unicode MS Bold';
@text_font_administrative: 'Arial Unicode MS Regular';
@text_font_administrative_bold: 'Arial Unicode MS Bold';
@text_font_water: 'Arial Unicode MS Italic';
@text_font_water_bold: 'Arial Unicode MS Bold Italic';
@text_font_city: 'Arial Unicode MS Regular';
@text_font_city_bold: 'Arial Unicode MS Bold';
@text_font_poi_bold: 'Arial Unicode MS Bold Italic';

@label_color_transport: #000;
@text_font_halo_radius_sm: 1;
@label_color_transport_halo: #fff;
@label_color_physical: #000;
@label_color_physical_halo: #fff;
@label_color_administrative: #000;
@label_color_administrative_halo: #fff;
@label_color_city: #000;
@label_color_city_halo: #fff;
@label_color_poi: #000;
@label_color_poi_halo: #fff;

@text_font_size_xxsm: 10;
@text_font_size_xsm: 12;
@text_font_size_sm: 13;
@text_font_size_medium: 14;
@text_font_size_medium_plus: 16;
@text_font_size_large: 18;
@text_font_halo_radius_large: 2;

#minor_road_labels {
  text-name: "[name]";
  text-face-name: @text_font_transport_bold;
  text-placement: line;
  text-max-char-angle-delta: 30;
  text-fill: @label_color_transport;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_transport_halo;
  text-avoid-edges: true;

  [zoom=16] {
    text-dy: 10;
    text-spacing: 124;
    text-size: @text_font_size_xxsm;
    text-halo-radius: @text_font_halo_radius_large;
  }
  [zoom=17] {
    text-dy: 13;
    text-spacing: 180;
    text-size: @text_font_size_xsm;
    text-halo-radius: @text_font_halo_radius_large;
  }
  [zoom>=18] {
    text-size: @text_font_size_xsm;
    text-spacing: 400;
    text-halo-radius: @text_font_halo_radius_large;
  }
}

#major_road_labels {
  text-name: "[name]";
  text-face-name: @text_font_transport_bold;
  text-placement: line;
  text-max-char-angle-delta: 30;
  text-fill: @label_color_transport;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_transport_halo;
  text-spacing: 100;
  text-avoid-edges: true;

  [zoom>=16][highway='primary'] {
	text-halo-radius: @text_font_halo_radius_large;
  }
  [is_tunnel=1][zoom>=15] {
	text-fill: #777;
  }
  [zoom=12] {
    text-dy: 7;
    text-size: @text_font_size_xsm;
    text-min-distance: 4;
  }
  [zoom=13] {
    text-dy: 8;
    text-min-distance: 5;
    [highway='trunk'] {
		text-size: @text_font_size_sm;
    }
    [highway='primary'] {
		text-size: 13;
    }
  }

  [zoom=14] {
    text-min-distance: 5;
    [highway='trunk'],[highway='primary'] {
		text-dy: 9;
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-dy: 7;
      	text-size: @text_font_size_xsm;
    }
  }

  [zoom=15] {
    text-min-distance: 10;
    [highway='trunk'],[highway='primary'] {
		text-dy: @text_font_size_xsm;
      	text-size: 15;
    }
    [highway='secondary'],[highway='tertiary'] {
		text-dy: 11;
      	text-size: @text_font_size_sm;
    }
  }

  [zoom=16] {
    text-min-distance: 12;
    text-dy: 13;
    [highway='trunk'],[highway='primary'] {
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'],[highway='tertiary'] {
      	text-spacing: 124;
      	text-size: @text_font_size_sm;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }

  [zoom=17] {
    text-min-distance: 12;
    [highway='trunk'] {
		text-dy: 16;
      	text-size: @text_font_size_medium_plus;
    }
    [highway='primary'] {
		text-dy: 14;
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-dy: 14;
      	text-spacing: 180;
      	text-size: @text_font_size_medium;
      	text-halo-radius: @text_font_halo_radius_large;
    }
    [highway='tertiary'] {
		text-dy: 13;
      	text-spacing: 180;
      	text-size: @text_font_size_xsm;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }

  [zoom>=18] {
    text-min-distance: 12;
    [highway='trunk'] {
		text-size: @text_font_size_medium_plus;
    }
    [highway='primary'] {
		text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-size: @text_font_size_medium;
		text-spacing: 300;
		text-halo-radius: @text_font_halo_radius_large;
    }
    [highway='tertiary'] {
        text-size: @text_font_size_xsm;
        text-spacing: 400;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }
}

#poi_station_labels {
  [zoom=17][railway='station'] {
	point-file: url('images/subway_sm.png');
  }

  [zoom>=18][railway='station'] {
	point-file: url('images/subway.png');
  }
}

#water-bodies-labels-low,
#water-bodies-labels-med,
#water-bodies-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
 	text-name: "[name]";
	text-face-name: @text_font_water;
    text-placement: point;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;
    text-fill: @label_color_physical_halo;
    text-halo-fill: @label_color_physical;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }
    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#green-areas-labels-low,
#green-areas-labels-med,
#green-areas-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
 	text-name: "[name]";
	text-face-name: @text_font_water;
    text-placement: point;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;

    text-fill: @label_color_physical;
    text-halo-fill: @label_color_physical_halo;

    text-line-spacing: -1;
    text-min-distance: 10;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }

    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#continents[zoom>=1][zoom<3]
{
  	text-name: "[name]";
    text-face-name: @text_font_physical_bold;
    text-wrap-width: 32;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical;
    text-halo-radius: 3;
    text-halo-fill: @label_color_physical_halo;
}

#admin1-labels-50m-z4 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z4]";
    text-size:  @text_font_size_xsm;
}

#admin1-labels-50m-z5 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z5]";
    text-size:  @text_font_size_medium_plus;
}

#admin1-labels-50m-z6 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z6]";
    text-size:  @text_font_size_large;
}

#admin1-labels-50m-z7 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z7]";
    text-size:  @text_font_size_large;
}

#admin0-labels-z3[longfrom>3] {
  	text-name: "[shortname]";
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-size: @text_font_size_sm;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
  	text-min-distance: 1;
}

#admin0-labels-z3[longfrom<=3] {
  	text-name: "[name]";
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-size: @text_font_size_sm;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z4 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z5 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium_plus;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z6 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_large;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

// HACK! All the problematic water bodies with accents
// e.g. "Bahia de Campeche" with an accented i,
// have an empty "changed" string. So abuse this for now.

#ne_110m_geography_marine_polys[zoom=2][scalerank=0][changed!=''],
#ne_110m_geography_marine_polys[zoom=3][changed!=''],
#ne_50m_geography_marine_polys[zoom=4][scalerank<4][changed!=''] {
    text-name: "[name]";
	text-face-name: @text_font_water_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical_halo;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_physical;
}

#ne_50m_geography_marine_polys[zoom=5][changed!=''],
#ne_10m_geography_marine_polys[zoom>=6][zoom<=8][changed!='']
{
  	text-name: "[name]";
    text-face-name: @text_font_water;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical_halo;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_physical;
}

#city_labels_z4,
#city_labels_z5,
#city_labels_z6 {
  	text-name: "[name]";
    text-face-name: @text_font_city;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
  	text-min-distance: 5;

  	#city_labels_z4 {
      text-size: @text_font_size_xxsm;
      [font_size=14] {
          text-size: @text_font_size_medium;
      }
    }

   	#city_labels_z5 {
      text-size: @text_font_size_xsm;
      [font_size=16] {
          text-size: @text_font_size_medium_plus;
      }
    }

    #city_labels_z6 {
      text-size: @text_font_size_xsm;
      [font_size=18] {
          text-size: @text_font_size_large;
      }
   }

    [justified='left'] {
    	text-horizontal-alignment: middle;
    	text-dx: -5;
    }
    [justified='right'] {
    	text-horizontal-alignment: middle;
    	text-dx: 5;
    }
}

#city_labels_z7,
#city_labels_z8, {
	text-name: "[name]";
    text-face-name: @text_font_city_bold;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
	text-size: @text_font_size_sm;
    [font_size=20] { text-size: @text_font_size_large; }

  	#city_labels_z7 {
   	  text-size: @text_font_size_xsm;
      [font_size=18] {
          text-size: @text_font_size_large;
      }
    }

  	[justified='left'] {
    	text-horizontal-alignment: middle;
    	text-dx: -5;
    }
    [justified='right'] {
    	text-horizontal-alignment: middle;
    	text-dx: 5;
    }
}

#city_labels_z9,
#city_labels_z10,
#city_labels_z11,
#city_labels_z12, {
  	text-name: "[name]";
    text-face-name: @text_font_city_bold;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
	text-size: @text_font_size_sm;
    [font_size=20] { text-size: @text_font_size_large; }
}

#city_points_z4,
#city_points_z5,
#city_points_z6,
#city_points_z7,
#city_points_z8 {
  	marker-ignore-placement: true;
  	marker-width: 7;
  	marker-fill: black;
  	marker-line-color: white;
  	marker-line-width: 2;
}

#airports[zoom>=10][zoom<=13] {
 	//marker-width: 5;
  	//marker-fill: red;
  	//marker-file: url("images/airplane-19-reverse.png");
	point-file: url('images/airplane-19-reverse.png');
}

#airports[zoom>=13][scalerank<=12]
{
  	text-name: "[name]";
    text-face-name: @text_font_poi_bold;
    text-fill: @label_color_poi;
    text-size: @text_font_size_medium;
    text-halo-fill: @label_color_poi_halo;
    text-halo-radius: @text_font_halo_radius_large;
    text-wrap-width: 128;
    text-dy: 14;
    text-allow-overlap: true;

  	[zoom>=14] {
    	text-dy: 0;
    }
}

@text_font_transport_bold: 'Arial Unicode MS Bold';
@text_font_physical_bold: 'Arial Unicode MS Bold';
@text_font_administrative: 'Arial Unicode MS Regular';
@text_font_administrative_bold: 'Arial Unicode MS Bold';
@text_font_water: 'Arial Unicode MS Italic';
@text_font_water_bold: 'Arial Unicode MS Bold Italic';
@text_font_city: 'Arial Unicode MS Regular';
@text_font_city_bold: 'Arial Unicode MS Bold';
@text_font_poi_bold: 'Arial Unicode MS Bold Italic';

@label_color_transport: #000;
@text_font_halo_radius_sm: 1;
@label_color_transport_halo: #fff;
@label_color_physical: #000;
@label_color_physical_halo: #fff;
@label_color_administrative: #000;
@label_color_administrative_halo: #fff;
@label_color_city: #000;
@label_color_city_halo: #fff;
@label_color_poi: #000;
@label_color_poi_halo: #fff;

@text_font_size_xxsm: 10;
@text_font_size_xsm: 12;
@text_font_size_sm: 13;
@text_font_size_medium: 14;
@text_font_size_medium_plus: 16;
@text_font_size_large: 18;
@text_font_halo_radius_large: 2;

#minor_road_labels {
  text-name: "[name]";
  text-face-name: @text_font_transport_bold;
  text-placement: line;
  text-max-char-angle-delta: 30;
  text-fill: @label_color_transport;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_transport_halo;
  text-avoid-edges: true;

  [zoom=16] {
    text-dy: 10;
    text-spacing: 124;
    text-size: @text_font_size_xxsm;
    text-halo-radius: @text_font_halo_radius_large;
  }
  [zoom=17] {
    text-dy: 13;
    text-spacing: 180;
    text-size: @text_font_size_xsm;
    text-halo-radius: @text_font_halo_radius_large;
  }
  [zoom>=18] {
    text-size: @text_font_size_xsm;
    text-spacing: 400;
    text-halo-radius: @text_font_halo_radius_large;
  }
}

#major_road_labels {
  text-name: "[name]";
  text-face-name: @text_font_transport_bold;
  text-placement: line;
  text-max-char-angle-delta: 30;
  text-fill: @label_color_transport;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_transport_halo;
  text-spacing: 100;
  text-avoid-edges: true;

  [zoom>=16][highway='primary'] {
	text-halo-radius: @text_font_halo_radius_large;
  }
  [is_tunnel=1][zoom>=15] {
	text-fill: #777;
  }
  [zoom=12] {
    text-dy: 7;
    text-size: @text_font_size_xsm;
    text-min-distance: 4;
  }
  [zoom=13] {
    text-dy: 8;
    text-min-distance: 5;
    [highway='trunk'] {
		text-size: @text_font_size_sm;
    }
    [highway='primary'] {
		text-size: 13;
    }
  }

  [zoom=14] {
    text-min-distance: 5;
    [highway='trunk'],[highway='primary'] {
		text-dy: 9;
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-dy: 7;
      	text-size: @text_font_size_xsm;
    }
  }

  [zoom=15] {
    text-min-distance: 10;
    [highway='trunk'],[highway='primary'] {
		text-dy: @text_font_size_xsm;
      	text-size: 15;
    }
    [highway='secondary'],[highway='tertiary'] {
		text-dy: 11;
      	text-size: @text_font_size_sm;
    }
  }

  [zoom=16] {
    text-min-distance: 12;
    text-dy: 13;
    [highway='trunk'],[highway='primary'] {
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'],[highway='tertiary'] {
      	text-spacing: 124;
      	text-size: @text_font_size_sm;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }

  [zoom=17] {
    text-min-distance: 12;
    [highway='trunk'] {
		text-dy: 16;
      	text-size: @text_font_size_medium_plus;
    }
    [highway='primary'] {
		text-dy: 14;
      	text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-dy: 14;
      	text-spacing: 180;
      	text-size: @text_font_size_medium;
      	text-halo-radius: @text_font_halo_radius_large;
    }
    [highway='tertiary'] {
		text-dy: 13;
      	text-spacing: 180;
      	text-size: @text_font_size_xsm;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }

  [zoom>=18] {
    text-min-distance: 12;
    [highway='trunk'] {
		text-size: @text_font_size_medium_plus;
    }
    [highway='primary'] {
		text-size: @text_font_size_medium;
    }
    [highway='secondary'] {
		text-size: @text_font_size_medium;
		text-spacing: 300;
		text-halo-radius: @text_font_halo_radius_large;
    }
    [highway='tertiary'] {
        text-size: @text_font_size_xsm;
        text-spacing: 400;
      	text-halo-radius: @text_font_halo_radius_large;
    }
  }
}

#poi_station_labels {
  [zoom=17][railway='station'] {
	point-file: url('images/subway_sm.png');
  }

  [zoom>=18][railway='station'] {
	point-file: url('images/subway.png');
  }
}

#water-bodies-labels-low,
#water-bodies-labels-med,
#water-bodies-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
 	text-name: "[name]";
	text-face-name: @text_font_water;
    text-placement: point;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;
    text-fill: @label_color_physical_halo;
    text-halo-fill: @label_color_physical;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }
    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#green-areas-labels-low,
#green-areas-labels-med,
#green-areas-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
 	text-name: "[name]";
	text-face-name: @text_font_water;
    text-placement: point;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;

    text-fill: @label_color_physical;
    text-halo-fill: @label_color_physical_halo;

    text-line-spacing: -1;
    text-min-distance: 10;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }

    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#continents[zoom>=1][zoom<3]
{
  	text-name: "[name]";
    text-face-name: @text_font_physical_bold;
    text-wrap-width: 32;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical;
    text-halo-radius: 3;
    text-halo-fill: @label_color_physical_halo;
}

#admin1-labels-50m-z4 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z4]";
    text-size:  @text_font_size_xsm;
}

#admin1-labels-50m-z5 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z5]";
    text-size:  @text_font_size_medium_plus;
}

#admin1-labels-50m-z6 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z6]";
    text-size:  @text_font_size_large;
}

#admin1-labels-50m-z7 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
    text-name: "[label_z7]";
    text-size:  @text_font_size_large;
}

#admin0-labels-z3[longfrom>3] {
  	text-name: "[shortname]";
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-size: @text_font_size_sm;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
  	text-min-distance: 1;
}

#admin0-labels-z3[longfrom<=3] {
  	text-name: "[name]";
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-size: @text_font_size_sm;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z4 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z5 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium_plus;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#admin0-labels-z6 {
  	text-name: "[name]";
    text-face-name: @text_font_administrative_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_large;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_administrative_halo;
}

#ne_110m_geography_marine_polys[zoom=2][scalerank=0],
#ne_110m_geography_marine_polys[zoom=3],
#ne_50m_geography_marine_polys[zoom=4][scalerank<4] {
    text-name: "[name]";
	text-face-name: @text_font_water_bold;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical_halo;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_physical;
}

#ne_50m_geography_marine_polys[zoom=5],
#ne_10m_geography_marine_polys[zoom>=6][zoom<=8]
{
  	text-name: "[name]";
    text-face-name: @text_font_water;
    text-wrap-width: 80;
    text-size: @text_font_size_medium;
    text-fill: @label_color_physical_halo;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_physical;
}

#city_labels_z4,
#city_labels_z5,
#city_labels_z6 {
  	text-name: "[name]";
    text-face-name: @text_font_city;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
  	text-min-distance: 5;

  	#city_labels_z4 {
      text-size: @text_font_size_xxsm;
      [font_size=14] {
          text-size: @text_font_size_medium;
      }
    }

   	#city_labels_z5 {
      text-size: @text_font_size_xsm;
      [font_size=16] {
          text-size: @text_font_size_medium_plus;
      }
    }

    #city_labels_z6 {
      text-size: @text_font_size_xsm;
      [font_size=18] {
          text-size: @text_font_size_large;
      }
   }

    [justified='left'] {
    	text-horizontal-alignment: middle;
    	text-dx: -5;
    }
    [justified='right'] {
    	text-horizontal-alignment: middle;
    	text-dx: 5;
    }
}

#city_labels_z7,
#city_labels_z8, {
	text-name: "[name]";
    text-face-name: @text_font_city_bold;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
	text-size: @text_font_size_sm;
    [font_size=20] { text-size: @text_font_size_large; }

  	#city_labels_z7 {
   	  text-size: @text_font_size_xsm;
      [font_size=18] {
          text-size: @text_font_size_large;
      }
    }

  	[justified='left'] {
    	text-horizontal-alignment: middle;
    	text-dx: -5;
    }
    [justified='right'] {
    	text-horizontal-alignment: middle;
    	text-dx: 5;
    }
}

#city_labels_z9,
#city_labels_z10,
#city_labels_z11,
#city_labels_z12, {
  	text-name: "[name]";
    text-face-name: @text_font_city_bold;
    text-fill: @label_color_city;
    text-halo-radius: @text_font_halo_radius_large;
    text-halo-fill: @label_color_city_halo;
	text-size: @text_font_size_sm;
    [font_size=20] { text-size: @text_font_size_large; }
}

#city_points_z4,
#city_points_z5,
#city_points_z6,
#city_points_z7,
#city_points_z8 {
  	marker-ignore-placement: true;
  	marker-width: 7;
  	marker-fill: black;
  	marker-line-color: white;
  	marker-line-width: 2;
}

#airports[zoom>=10][zoom<=13] {
 	//marker-width: 5;
  	//marker-fill: red;
  	//marker-file: url("images/airplane-19-reverse.png");
	point-file: url('images/airplane-19-reverse.png');
}

#airports[zoom>=13][scalerank<=12]
{
  	text-name: "[name]";
    text-face-name: @text_font_poi_bold;
    text-fill: @label_color_poi;
    text-size: @text_font_size_medium;
    text-halo-fill: @label_color_poi_halo;
    text-halo-radius: @text_font_halo_radius_large;
    text-wrap-width: 128;
    text-dy: 14;
    text-allow-overlap: true;

  	[zoom>=14] {
    	text-dy: 0;
    }
}


Prevent Sib 2018 from crashing in CloseActiveScore()

function Run() {
  plugins = Sibelius.Plugins;

  if (not (plugins.Contains('Test'))) {
    Sibelius.MessageBox('Please install the Test plugin!');
    ExitPlugin();
  }

  Self._property:pluginDir = GetPluginFolder('sibmei2.plg');
  Self._property:_SibTestFileDirectory = pluginDir & 'sibmeiTestSibs'
      & Sibelius.PathSeparator;
  Self._property:discardFilePath = pluginDir & '_discard.sib';

  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestExportConverters')
    .AddModule('TestLibmei')
    .AddModule('TestExportGenerators')
    .AddModule('TestUtilities')
  // suite
  //   .AddModule('TestExportGenerators')
    ;

  suite.Run();

  sibmei_batch_sib.ConvertFolder(Sibelius.GetFolder(_SibTestFileDirectory));
  Trace('Run `npm test` to test output written to ' & _SibTestFileDirectory);
}  //$end

function GetPluginFolder(plgName) {
  //$module(Run.mss)
  plgNameLength = Length(plgName);

  for each plugin in Sibelius.Plugins
  {
    path = plugin.File;
    i = Length(path) - 2;
    while (i >= 0 and CharAt(path, i) != Sibelius.PathSeparator) {
        i = i - 1;
    }

    if (Substring(path, i + 1) = plgName) {
      return Substring(path, 0, i + 1);
    }
  }

  Sibelius.MessageBox(plgName & ' was not found');
  ExitPlugin();
}  //$end

function CloseActiveScore() {
    //$module(Run.mss)
    filePath = Sibelius.ActiveScore.FileName;
    pathComponents = SplitString(filePath, Sibelius.PathSeparator);
    if (pathComponents.NumChildren = 1)
    {
      // If there's no path separator in the file name, we have a new file that
      // has not been saved yet. In that case, Sibelius.CloseWindow() will not
      // close the file properly, so we save to a 'discard' file first.
      // We also have to delete any pre-existing discard file because Sib 2018
      // would otherwise crash.
      Sibelius.GetFile(discardFilePath).Delete();
      Sibelius.ActiveScore.Save(discardFilePath);
    }
    Sibelius.CloseWindow(False);
}  //$end

function RunLibmeiTests () {
  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestLibmei')
    ;

  suite.Run();
}  //$end

function RunGeneratorTests () {
  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestExportGenerators')
    ;

  suite.Run();

}  //$end

function Run() {
  plugins = Sibelius.Plugins;

  if (not (plugins.Contains('Test'))) {
    Sibelius.MessageBox('Please install the Test plugin!');
    ExitPlugin();
  }

  Self._property:pluginDir = GetPluginFolder('sibmei2.plg');
  Self._property:_SibTestFileDirectory = pluginDir & 'sibmeiTestSibs'
      & Sibelius.PathSeparator;

  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestExportConverters')
    .AddModule('TestLibmei')
    .AddModule('TestExportGenerators')
    .AddModule('TestUtilities')
  // suite
  //   .AddModule('TestExportGenerators')
    ;

  suite.Run();

  sibmei_batch_sib.ConvertFolder(Sibelius.GetFolder(_SibTestFileDirectory));
  Trace('Run `npm test` to test output written to ' & _SibTestFileDirectory);
}  //$end

function GetPluginFolder(plgName) {
  //$module(Run.mss)
  plgNameLength = Length(plgName);

  for each plugin in Sibelius.Plugins
  {
    path = plugin.File;
    i = Length(path) - 2;
    while (i >= 0 and CharAt(path, i) != Sibelius.PathSeparator) {
        i = i - 1;
    }

    if (Substring(path, i + 1) = plgName) {
      return Substring(path, 0, i + 1);
    }
  }

  Sibelius.MessageBox(plgName & ' was not found');
  ExitPlugin();
}  //$end

function CloseActiveScore() {
    //$module(Run.mss)
    filePath = Sibelius.ActiveScore.FileName;
    pathComponents = SplitString(filePath, Sibelius.PathSeparator);
    if (pathComponents.NumChildren = 1)
    {
      // If there's no path separator in the file name, we have a new file that
      // has not been saved yet. In that case, Sibelius.CloseWindow() will not
      // close the file properly, so we have to save it first.
      Sibelius.ActiveScore.Save(pluginDir & '_tmp.sib');
    }
    Sibelius.CloseWindow(False);
}  //$end

function RunLibmeiTests () {
  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestLibmei')
    ;

  suite.Run();
}  //$end

function RunGeneratorTests () {
  suite = Test.Suite('Sibelius MEI Exporter', Self, sibmei2);

  suite
    .AddModule('TestExportGenerators')
    ;

  suite.Run();

}  //$end