You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordCloud2字体家族随机未生效问题排查求助

词云部分字体不生效,跨浏览器/设备字体显示异常问题

我的词云整体表现良好,但存在跨场景的字体显示异常问题:

  • iPhone 13上,"Open"、"Fun"、"Felt"、"New"、"Deal"、"Feels"、"Genuinely"这7个单词均显示为衬线字体,未应用指定的Roboto字体
  • 同事使用桌面端Chrome时,仅"Deal"一个单词字体显示异常
  • 我在桌面端FireFox、Chrome、Safari中显示正常,但底部存在未知截断问题

全站统一使用Roboto字体,CSS中已设置回退字体,但不清楚如何在WordCloud2脚本中配置回退字体,也不确定回退字体能否解决该问题。怀疑是脚本bug,但无法定位具体问题。

当前WordCloud2的配置参数如下:

list: list,
FontSize: 250,
fontFamily: 'Roboto',
fontWeight: '900',
minFontSize: 10,
backgroundColor: '#fff',
color: function (word, weight) {
    return weight > 9 ? '#32587d' :
        ['#b5c1af', '#c88362', '#e0c094'][Math.floor(Math.random() * 3)];
},
weightFactor: 19,
drawOutOfBound: false,
shrinkToFit: true,
wait: 50,
shuffle: false,

abortThreshold: 0,
abort: function noop () {},
minRotation: 0,
MaxRotation: 0,
rotationSteps: 0,
rotateRatio: 0,
classes: null,
hover: null,
click: null

内容的提问来源于stack exchange,提问作者Laura Sage

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 23:25:17