autokerning
Version:
autokerning computes suggested kerning values for glyph pairs from TrueType/OpenType fonts by rendering glyph bitmaps, applying a small Gaussian blur, and measuring pixel overlap across horizontal offsets. It can be used programmatically (as an imported E
41 lines (40 loc) • 963 B
JavaScript
const env = (process.env.LOG_LEVEL ||
process.env.NODE_LOG_LEVEL ||
"info").toLowerCase();
const levels = {
debug: 10,
info: 20,
warn: 30,
error: 40,
};
const current = env === "info" || env === "warn" || env === "error"
? env
: "info";
function shouldLog(level) {
return levels[level] >= levels[current];
}
export const logger = {
debug: (...args) => {
if (!shouldLog("debug"))
return;
// Use console.debug if available, fallback to console.log
(console.debug || console.log)(...args);
},
info: (...args) => {
if (!shouldLog("info"))
return;
console.log(...args);
},
warn: (...args) => {
if (!shouldLog("warn"))
return;
console.warn(...args);
},
error: (...args) => {
if (!shouldLog("error"))
return;
console.error(...args);
},
level: current,
};
export default logger;