[英]How can I render Emojis on Openlayers 4 map?
I am told to render emojis on an openlayers 4 map. 有人告诉我在openlayers 4地图上渲染表情符号。
Now I found several examples on how to use custom map markers, but that does not exactly fit my needs. 现在,我找到了一些有关如何使用自定义地图标记的示例,但这并不完全符合我的需求。
Is there a way to render emojis on an openlayers 4 map? 有没有办法在openlayers 4地图上渲染表情符号?
This is the test data I used (GeoJSON): 这是我使用的测试数据(GeoJSON):
{
features: [
{
type: 'Feature',
id: '1016392629',
geometry: {
type: 'Point',
coordinates: [6.0, 6.0]
},
properties: {
text: '\u1F31E',
}
},
{
type: 'Feature',
id: '-2026663018',
geometry: {
type: 'Point',
coordinates: [0.0, 0.0]
},
properties: {
text: '\u1F31E',
}
}
],
type: 'FeatureCollection'
}
and using a style function: 并使用样式功能:
style: (feature: Feature) => {
const { font, textBaseline, fillColor } = this.options;
const s: ol.style.Style = new ol.style.Style({
text: new ol.style.Text({
text: feature.getProperties().text,
font,
textBaseline,
fill: new ol.style.Fill({
color: fillColor
})
}),
zIndex: 1
});
return s;
}
But this only gives me: 但这只会给我:
Emoji in JS has two characters. JS中的表情符号有两个字符。 (UTF-16 need to be represented with two codes)
(UTF-16需要用两个代码表示)
So smiley emoji is: '\?\?'
= 😀 所以笑脸表情符号是:
'\?\?'
=😀
Now, your emoji, '\ἱE'
(Sunny), will be: '\?\?'
= 🌞. 现在,您的表情符号
'\ἱE'
(Sunny)将为: '\?\?'
=🌞。
Read on about lead-surrogate and tail-surrogate at: medium.com: emojis-in-javascript 在以下网址继续阅读有关铅替代和尾替代的信息: emojis-in-javascript
Simple google finds me online resources mapping the emoji at: timwhitlock.info emoji tables And you can inspect each character timwhitlock.info inspect 1F31E 简单的Google在以下位置找到了映射表情符号的在线资源: timwhitlock.info表情符号表您可以检查每个字符timwhitlock.info检查1F31E
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.