Noto Sansフォントの数字と記号に指定したem単位のパディングを追加し、超軽量なwoff2フォントファイルを生成するPythonコマンドラインツールです。
- 🔢 数字と記号のみに特化: 0-9と■•◦●*の15個のグリフのみを処理
- 📏 統一幅調整: 「0」グリフを基準に全グリフを同じ幅に統一
- 🎯 中央配置: 各グリフが統一幅の中央に配置される
- 📦 超軽量WOFF2: サブセット化により最小限のファイルサイズを実現
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Translation Test</title> | |
| </head> | |
| <body> | |
| <nav aria-label="You are here"> | |
| <ol> | |
| <li><a href="#">Home</a></li> |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Form</title> | |
| </head> | |
| <body> | |
| <p> | |
| URL: <input id="url" type="text" readonly style="width:60em"> |
| const { XMLParser, XMLBuilder } = require('fast-xml-parser'); | |
| const presentationAttrs = [ | |
| 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-rendering', | |
| 'cursor', 'display', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', | |
| 'opacity', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', | |
| 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', | |
| 'stroke-opacity', 'stroke-width', 'transform', 'vector-effect', 'visibility', | |
| ]; |
| let pageVisible = true; | |
| function updatePageVisibility(e) { | |
| if (e.type === "visibilitychange") { | |
| pageVisible = !document.hidden; | |
| } else { | |
| const typeVisibilityMap = { blur: false, focus: true, pagehide: false, pageshow: true }; | |
| pageVisible = typeVisibilityMap[e.type]; | |
| } | |
| } |
| export function waitForGlobalVariable(objPath, interval, timeout, callback) { | |
| function find(objPath) { | |
| var found = window; | |
| objPath = objPath.split("."); | |
| while (objPath.length > 0) { | |
| var objPart = objPath.shift(); | |
| if (objPart in found) { | |
| found = found[objPart]; | |
| } else { | |
| return null; |
| /** | |
| * @param {number} delay | |
| * @param {Function} callback | |
| * @returns {Function} | |
| */ | |
| function debounce(delay, callback) { | |
| var timer = 0; | |
| return function () { | |
| var self = this; | |
| var args = arguments; |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Load polyfills conditionally from CDN</title> | |
| <script> | |
| function loadFromCdn(src, integrity) { | |
| var s = document.createElement("script"); | |
| s.src = src; | |
| s.integrity = integrity; |
| /** | |
| * ツリー上で最初に登場するテキストノードを深さ優先で探索し取得する | |
| */ | |
| function getFirstTextNode(root) { | |
| return traverse(root, (node) => node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== ""); | |
| } | |
| /** | |
| * ツリー上で最後に登場するテキストノードを深さ優先で探索し取得する | |
| */ |
| #!/usr/bin/env node | |
| /** | |
| * @fileoverview rem を 10/16 倍する | |
| * @example cat styles.css | ./adjust-rem > styles.css | |
| */ | |
| const { readFileSync } - require("fs"); | |
| const postcss = require("postcss"); |