#Techniques for Anti-Aliasing @font-face on Windows
It all started with an email from a client: Do these fonts look funky to you? The title is prickly.
The font in question was Port Lligat Sans from Google Web Fonts.
// This function can be impure in JS context... | |
function sum(arr) { | |
var z = 0; | |
for (var i=0;i<arr.length;i++) { | |
z += arr[i]; | |
} | |
return z; | |
} | |
// sec 1: valueOf() impureness |
import ReactDOM from 'react'; | |
// render without using JSX | |
export function jsRender(Component, data={}, targetElement, callback=null) { | |
ReactDOM.render(<Component {...data} />, targetElement, callback) | |
} | |
// Render after specific element. | |
export function wrappedRenderCreator( |
function pp(givenNth/*: int*/, curNth = 0/*: int*/, dir = 1 /* { 1 | -1 } */, result = 0/*: int*/) { | |
// console.log(arguments[1], arguments[2], arguments[3]); | |
'use strict'; | |
if (givenNth === curNth) { | |
return result; | |
} else { | |
return pp(givenNth, curNth + 1, isTurnAround(curNth + 1) * dir, result + dir); | |
} | |
} |
// % | |
function mod(num, by) { | |
var tmp_num = num; | |
while (tmp_num - by >= 0) { | |
tmp_num -= by | |
} | |
return tmp_num; | |
} | |
function fizzbuzzMod (limit) { |
export function debounceUntilTimeout(fun, delay, context = null) { | |
var timer; | |
return function delayedFunctionWrapper(...args) { | |
clearTimeout(timer); | |
args.unshift(context); | |
timer = setTimeout(fun.bind.apply(fun, args), delay); | |
}; | |
} |
export const Display = { | |
None: { display: 'none' }, | |
Block: { display: 'block' }, | |
Inline: { display: 'inline' }, | |
InlineBlock: { display: 'inline-block' }, | |
NoneIf(cond) { | |
return cond ? Display.None : null; | |
}, | |
BlockIf(cond) { | |
return cond ? Display.Block : null; |
// To make the most of native browser click event | |
// Util.js | |
export function isPlainLeftClick(event) { | |
return !(event.button !== 0 || event.altKey || event.metaKey || event.ctrlKey || event.shiftKey); | |
} | |
// index.js | |
import { isPlainLeftClick } from 'Util'; | |
el.on('click', event => { |
document.addEventListener('touchmove', function(e){e.preventDefault();}, false); |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
#Techniques for Anti-Aliasing @font-face on Windows
It all started with an email from a client: Do these fonts look funky to you? The title is prickly.
The font in question was Port Lligat Sans from Google Web Fonts.