使用字形为标签设置样式 - Amazon Location Service

使用字形为标签设置样式

字形是包含已编码 Unicode 字符的二进制文件,由地图渲染器用来显示标签。Amazon Location Service 允许从字体堆栈中检索特定字形,以便通过 GetGlyphs API 用于地图渲染。

有关更多信息,请参阅《Amazon Location Service API 参考》中的 GetGlyphs

使用案例

  • 使用特定字体和样式在地图上渲染自定义文本。

  • 获取用于本地化地图文本渲染的字形。

  • 使用 Unicode 字符范围来显示地图标签和符号。

  • 根据字体堆栈和字形范围来优化地图字体渲染。

API 中支持的字体

API 中支持以下字体:

  • Amazon Ember 粗体

  • Amazon Ember 粗体斜体

  • Amazon Ember 粗体、Noto Sans 粗体

  • Amazon Ember 粗体、Noto Sans 粗体、Noto Sans Arabic 粗体

  • Amazon Ember Condensed RC BdItalic

  • Amazon Ember Condensed RC 粗体

  • Amazon Ember Condensed RC 粗体斜体

  • Amazon Ember Condensed RC 粗体、Noto Sans 粗体

  • Amazon Ember Consending RC 粗体、Noto Sans 粗体、Noto Sans

  • Amazon Ember Condensed RC Light

  • Amazon Ember Condensed RC Light 斜体

  • Amazon Ember Condensed RC LtItalic

  • Amazon Ember Condensed RC 常规

  • Amazon Ember Condensed RC 常规斜体

  • Amazon Ember Condensed RC 常规、Noto Sans 常规

  • Amazon Ember Condensed RC 常规、Noto Sans 常规、Noto Sans Arabic Condensed 常规

  • Amazon Ember Condensed RC RgItalic

  • Amazon Ember Condensed RC ThItalic

  • Amazon Ember Condensed RC Thin

  • Amazon Ember Condensed RC Thin 斜体

  • Amazon Ember Heavy

  • Amazon Ember Heavy 斜体

  • Amazon Ember Light

  • Amazon Ember Light 斜体

  • Amazon Ember 中等

  • Amazon Ember 中等斜体

  • Amazon Ember 中等、Noto Sans 中等

  • Amazon Ember 中等、Noto Sans 中等、Noto Sans Arabic 中等

  • Amazon Ember 常规

  • Amazon Ember 常规斜体

  • Amazon Ember 常规斜体、Noto Sans 斜体

  • Amazon Ember 常规斜体、Noto Sans 斜体、Noto Sans Arabic 常规

  • Amazon Ember 常规、Noto Sans 常规

  • Amazon Ember 常规、Noto Sans 常规、Noto Sans Arabic 常规

  • Amazon Ember Thin

  • Amazon Ember Thin 斜体

  • AmazonEmberCdRC_Bd

  • AmazonEmberCdRC_BdIt

  • AmazonEmberCdRC_Lt

  • AmazonEmberCdRC_LtIt

  • AmazonEmberCdRC_Rg

  • AmazonEmberCdRC_RgIt

  • AmazonEmberCdRC_Th

  • AmazonEmberCdRC_ThIt

  • AmazonEmber_Bd

  • AmazonEmber_BdIt

  • AmazonEmber_He

  • AmazonEmber_HeIt

  • AmazonEmber_Lt

  • AmazonEmber_LtIt

  • AmazonEmber_Md

  • AmazonEmber_MdIt

  • AmazonEmber_Rg

  • AmazonEmber_RgIt

  • AmazonEmber_Th

  • AmazonEmber_ThIt

  • Noto Sans 黑体

  • Noto Sans 黑体斜体

  • Noto Sans 粗体

  • Noto Sans 粗体斜体

  • Noto Sans 超粗

  • Noto Sans 超粗斜体

  • Noto Sans Extra Light

  • Noto Sans Extra Light 斜体

  • Noto Sans 斜体

  • Noto Sans Light

  • Noto Sans Light 斜体

  • Noto Sans 中等

  • Noto Sans 中等斜体

  • Noto Sans 常规

  • Noto Sans 半粗

  • Noto Sans 半粗斜体

  • Noto Sans Thin

  • Noto Sans Thin 斜体

  • NotoSans-Bold

  • NotoSans-Italic

  • NotoSans-Medium

  • NotoSans-Regular

  • Open Sans 常规、Arial Unicode MS 常规

了解请求

该请求接受两个必需的 URI 参数,即 FontStackFontUnicodeRange,它们确定字形的字体和 Unicode 范围。FontStack 参数指定要使用的字体,而 FontUnicodeRange 定义要获取的字符范围。该请求不包含正文,仅关注实现其功能的 URI 参数。

  • FontStack:指定要检索的字体堆栈的名称。示例:“Amazon Ember 粗体、Noto Sans 粗体”。

  • FontUnicodeRange:要下载字形的 Unicode 字符范围。该范围必须是 256 的倍数区间。示例:“0-255”。

了解响应

该响应以二进制 blob 的形式返回字形数据,并提供用于缓存、内容类型、ETag 和定价信息的 HTTP 标头。字形数据以二进制 blob 的形式返回,以便在地图上渲染,而标头则提供用于有效处理响应的额外元数据。

  • CacheControl:指示客户端对响应的配置进行缓存。

  • ContentType:指定响应正文的格式,指明所返回字形数据的类型。

  • ETag:字形版本的标识符,用于进行缓存验证。

  • PricingBucket:表示与请求关联的定价层级。

  • Blob:以二进制 blob 形式返回的字形数据,用于渲染地图文本。