VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-acomp__js__tool__TextMeasurement.js
/*** module: node_modules/absol-acomp/js/tool/TextMeasurement.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

/**
 * @deprecated use TextMeasure instead
 * @param opts
 * @constructor
 */
function TextMeasurement(opts) {
  opts = opts || {};
  this.chars = opts.chars || (" !\"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "[\\]^_abcdefghijklmnopqrstuvwxyz{|}" + "¥©ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíñòóôõùúýĂăĐđĨĩŨũƠơƯưẠ̌̀́̃̉Р" + "ийксуẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊị" + "ỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ–’“”…₫€?").split('');
  this.computed = Object.assign({}, opts.computed || {});
}

TextMeasurement.prototype.compute = function (font) {
  if (this.computed[font]) return true;
  if (!('document' in window)) return false;

  if (!this.canvas) {
    this.canvas = document.createElement('canvas');
    this.ctx = this.canvas.getContext('2d');
  }

  var ctx = this.ctx;
  ctx.font = font;
  var data = {};
  var charBoxes = {};
  data.charBoxes = charBoxes;
  var c, d, i, j;
  var metrics;
  var n = this.chars.length;
  var chars = this.chars;

  for (i = 0; i < n; ++i) {
    c = chars[i];
    metrics = ctx.measureText(c);
    charBoxes[c] = metrics.width;
  }

  var spacing = {};
  data.spacing = spacing;
  var pair;

  for (i = 0; i < n; ++i) {
    c = chars[i];

    for (j = 0; j < n; ++j) {
      d = chars[j];
      pair = c + d;
      metrics = ctx.measureText(pair);
      spacing[pair] = metrics.width - charBoxes[c] - charBoxes[d];
    }
  }

  this.computed[font] = data;
  return true;
};
/***
 *
 * @param {string} text
 * @param {string=} font
 * @return {number}
 */


TextMeasurement.prototype.measureTextWidth = function (text, font) {
  var l = text.length;
  if (l === 0) return 0;
  var width = 0;
  var data = this.computed[font];
  var charBoxes = data.charBoxes;
  var spacing = data.spacing;
  var c, pc;
  pc = text[0];
  width += charBoxes[pc] || charBoxes['0'];

  for (var i = 1; i < l; ++i) {
    c = text[i];
    width += spacing[pc + c];
    width += charBoxes[c] || charBoxes['0'];
    pc = c;
  }

  return width;
};

var _default = TextMeasurement;
exports.default = _default;

VaKeR 2022