【问题标题】:Getting list of available fonts as combo box in javascript在javascript中获取可用字体列表作为组合框
【发布时间】:2015-03-09 22:24:41
【问题描述】:

我需要获取所有可用字体的列表,以便在组合框下显示它们。 当用户选择一种字体时 -> 所选文本应因其选择而改变。 我的问题是我没有找到包含使用 chrome 浏览器作为示例获得的所有字体的完整列表。

我的意思是我不需要下载的家庭字体,例如“David”、“Times New Roman”等?

我应该从哪里得到这么详细的清单。

我的实现:

 var getFontsFamily = function () {
    var fonts = [];

    var cursiveFont = new ComboBoxElement("cursive", "cursive");
    fonts.push(cursiveFont);

    var fantasyFont = new ComboBoxElement("fantasy", "fantasy");
    fonts.push(fantasyFont);

    var initialFont = new ComboBoxElement("initial", "initial");
    fonts.push(initialFont);

    var monospaceFont = new ComboBoxElement("monospace", "monospace");
    fonts.push(monospaceFont);

    var sanSerifFont = new ComboBoxElement("sans-serif", "sans-serif");
    fonts.push(sanSerifFont);

    var serifFont = new ComboBoxElement("serif", "serif");
    fonts.push(serifFont);

    return fonts;
};

在我的控制器中: $scope.fonts = helperCtrl.getFontsFamily();

在我的 html 中:

 <div class="customizedSelect">
    <select id="groupSelection" 
ng-model="selectedText.fontFamily" ng-options="font.type as font.value for font in fonts"></select>
 </div>


<div ng-class="{bold : item.isBold == true}" style="color:{{item.textColor}}; font-size:{{item.size}}pt; font-family:{{item.fontFamily}}">{{item.text}}</div>

此外,我需要将这些字体显示在 android 中,作为连接 web 和 android 的平台。 safeweb 字体是跨平台的吗?

【问题讨论】:

    标签: android html css fonts


    【解决方案1】:

    我找到了这份清单: http://en.wikipedia.org/wiki/Font_family_(HTML)

    我希望它足够好。

    【讨论】:

      猜你喜欢
      • 2016-06-13
      • 2016-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      相关资源
      最近更新 更多