WebRoot/js/fonts.js

(开头部分) 64KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */

"use strict";

var isWorker = (typeof window == "undefined");

/**
 * Maximum file size of the font.
 */
var kMaxFontFileSize = 40000;

/**
 * Maximum time to wait for a font to be loaded by @font-face
 */
var kMaxWaitForFontFace = 1000;

/**
 * Useful for debugging when you want to certains operations depending on how
 * many fonts are loaded.
 */
var fontCount = 0;
var fontName  = "";

/**
 * If for some reason one want to debug without fonts activated, it just need
 * to turn this pref to true/false.
 */
var kDisableFonts = false;


/**
 * Hold a map of decoded fonts and of the standard fourteen Type1 fonts and
 * their acronyms.
 * TODO Add the standard fourteen Type1 fonts list by default
 *      http://cgit.freedesktop.org/poppler/poppler/tree/poppler/GfxFont.cc#n65
 */

var Fonts = (function Fonts() {
  var kScalePrecision = 40;
  var fonts = Object.create(null);

  if (!isWorker) {
    var ctx = document.createElement("canvas").getContext("2d");
    ctx.scale(1 / kScalePrecision, 1);
  }

  function Font(name, data, properties) {
    this.name = name;
    this.data = data;
    this.properties = properties;
    this.loading = true;
    this.charsCache = Object.create(null);
    this.sizes = [];
  }

  var current;
  var charsCache;
  var measureCache;

后面还有 1783 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。