在此处的地图中调整街道标签的字体大小

时间:2015-04-21 08:52:21

标签: css fonts font-size here-api

我们一直在研究这个问题已有一段时间了。但是,为了确认,我们是否可以通过这种方式增加街道标签的字体大小?我们知道我们可以使用以下方法自定义标记字体样式:

iconMarkup      = '<svg style="left:-{{{LEFT}}}px;top:-{{{TOP}}}px;"' 
                                + 'xmlns="http://www.w3.org/2000/svg" width="{{{WIDTH}}}px" height="{{{HEIGHT}}}px" >'
                                + '<g transform="scale({{{SCALE}}})"><path d="M 19 31 C 19 32.7 16.3 34 13 34 C 9.7 34 7 32.7 7 31 C 7 29.3 9.7 ' 
                                + '28 13 28 C 16.3 28 19 29.3 19 31 Z" fill="#000" fill-opacity=".2"></path>'
                                + '<path d="M 13 0 C 9.5 0 6.3 1.3 3.8 3.8 C 1.4 7.8 0 9.4 0 12.8 C 0 16.3 1.4 ' 
                                + '19.5 3.8 21.9 L 13 31 L 22.2 21.9 C 24.6 19.5 25.9 16.3 25.9 12.8 C 25.9 9.4 24.6 ' 
                                + '6.1 22.1 3.8 C 19.7 1.3 16.5 0 13 0 Z" fill="#fff"></path>'
                                + '<path d="M 13 2.2 C 6 2.2 2.3 7.2 2.1 12.8 C 2.1 16.1 3.1 18.4 5.2 20.5 L '
                                + '13 28.2 L 20.8 20.5 C 22.9 18.4 23.8 16.2 23.8 12.8 C 23.6 7.07 20 2.2 ' 
                                + '13 2.2 Z" fill="{{{COLOUR}}}"></path>'
                                + '<text transform="matrix( 1 0 0 1 13 18 )" x="0" y="0" fill-opacity="1" '
                                + 'fill="#fff" text-anchor="middle" '
                                + 'font-weight="bold" font-size="13px" font-family="arial">{{{REPLACE_TEXT}}}</text></g></svg>';

但仍然有办法增加地图街道标签的字体大小?与移动网站相比,它在移动设备中看起来太小了。

enter image description here

与:相比:



enter image description here

2 个答案:

答案 0 :(得分:2)

您可以使用Map Tile API中的ppi参数更改每英寸像素点数来执行此操作。您可以如下所示设置基础层:

function setBaseLayer(map, platform){
  var mapTileService = platform.getMapTileService({
      type: 'base'
    });
  var parameters = {
      ppi: '250'};
  var tileLayer = mapTileService.createTileLayer(
      'maptile',
      'normal.day',
      256,
      'png8',
      parameters
    );
  map.setBaseLayer(tileLayer);
}

有效值为72,250或320. 250通常用于移动设备。

比较以下内容:

enter image description here

normal.day 72 ppi

enter image description here

normal.day 250 ppi

或者使用normal.day.mobile架构而不是标准normal-day

enter image description here

normal.day.mobile 72 ppi

答案 1 :(得分:0)

只需添加&#34; Jason Fox发布的答案&#34; - 通过添加 normal.day.mobile 而不是 normal.day ,在移动视图上更有效:

var mapTileService = platform.getMapTileService({
                  type: 'base'
                });
              var parameters = {
                  ppi: '250'};
              var tileLayer = mapTileService.createTileLayer(
                  'maptile',
                  'normal.day.mobile',
                  256,
                  'png8',
                  parameters
                );
              map.setBaseLayer(tileLayer);