ipython / xkcd-font

The xkcd font
https://cdn.rawgit.com/ipython/xkcd-font/master/preview.html
Other
1.06k stars 48 forks source link

Attempt to fix kerning problems #5

Closed takluyver closed 10 years ago

takluyver commented 10 years ago

See issue #2. I'm a complete novice at font things, so I don't know if I've done this the right way, but I think the result looks better.

Here's a before and after, 18 point, using GIMP: xkcd font kerning before xkcd font kerning after xkcd font kerning after2

ellisonbg commented 10 years ago

@takluyver IANAFN (I am not a font nerd), but I think this is definitely an improvement. Some thoughts on particular digrams:

"OS" - looks a little tight? "OO" - also a little tight? - the odd thing is that the "OO" in "TOO" is not touching, but is in "UNDERSTOOD" "OD" - a little tight?

rgbkrk commented 10 years ago

Quite excellent!

Do the Ls and Is have a weird bit of blur to them?

ellisonbg commented 10 years ago

@jdfreder and I are working on some notebooks that can generate example text for kerning.

takluyver commented 10 years ago

I've tweaked those pairs a bit, though the tiny adjustment to OO doesn't appear to make any visible difference at that scale. There's a new image above for comparison.

I should also mention at this point that I'm only kerning the capital letter pairs, so if you type in lower case, or a mixture, you'll still get messy results. The rationale is that at some point we might get proper lowercase glyphs, in which case they'll need to be kerned separately.

@rgbkrk : they do, I think it's an artefact of rasterisation. Not sure how we can fix that.

rgbkrk commented 10 years ago

If I had to guess, we're not going to get lowercase glyphs (unless we ask) as the comic is always uppercase (with my limited sampling and memory).

Carreau commented 10 years ago

Love it.

takluyver commented 10 years ago

Clicking 'random' a bit brought up this one with lower case letters: http://xkcd.com/88/ , but I think you're mostly right. If there's enough interest, though, I guess someone could make lowercase letters in a similar style. Anyway, uppercase is all that I've kerned for now, so make use of your caps lock key when testing ;-)

ellisonbg commented 10 years ago

Here is a very simple approach to generating random text for kerning:

http://nbviewer.ipython.org/urls/gist.github.com/ellisonbg/6370424/raw/61dcfa5170d618db145a632d58bf6a62b3c544ee/RandomKerningText.ipynb

@jdfreder is working on an approach that tries to find an optimal word set using real words and a good optimization algorithm.

ellisonbg commented 10 years ago

Here is some random text for kerning from the above linked notebook. It is a lot to look at but might be useful:

BOLMCX GM FGJLNVCWYR ER GRVBQMZPTLI XQ IV OA ACBJUKRFYZDVTNP CQM MGFIYPK
XCVBGDOSNAE MNHLOYBESID KDHEJCPA HISNFCQA XRHYDGM KNXIT XEIMTQRGHJYO
THQEYJOPRLUFS UCFIBSWVNMZ SATXWUGLEPQN KJMVWNECSHGIP KAQDJEXUT TDYJGC
XGDPRHSLYVAOEB VTZBPLNRFK ZHAGVMUNIJBK ZPLDWOXEQIAH HEBUSTIQPGDWZJA RYZPWCJ
BCWEUXPJYSLT ASCKL CJUSVQTRGMFIOLN IQTX LQCEHAYF WZIAGVPXENR VLSKCFGAB VQIR
XYQGLKR WHGJCRDFY QTM FJPW ONZJITHC NDCQLKSJEFTX PDTHISXZEN MJ SLRZYIDPFMEWNCO
ZQLUCIRXJMADTK BKYGEP CVSN DYJMWGEV QUHMF BWCZTGIKNSHJ EFIVW QPKSVINJDOU
ISQBAGLWHZUK NR RG IWHPBXMNAYTKC YRQZFGKMCWLP XI DIRYSLVXH PXWUENBRIVTJZ FWJMKY
XMLEKDTF YKM QK SMCBPVXNOAH VGUJWCAINETRZ HCQPNAWM KZE GVYXRDLCQEJI XOUTSZD
KNCESXRQ QMYABHOJE IPM PBNGJMSZXRLHC TPDLIUVZ PO QMDXSBNTCPG HVQJYWNRBEMD VM
OPYSWMTFQZJG PU OHAZ FKNZTBGXRPJ RMBDCNGW DR KMYIWJHAFCSBET NDYGJUMKHFSPBC
LUWTYVBPIAXE UPIOGK SDGX HJGPWQZBKENX CALSDRHIOB VEAPOXLUWQ JL KEUQWRAFTXB
LJZHNUQCMBXW RECHY AJVP QLK IRQLYGZSHD AJIGKBF QHEAFDSXLZTCG ZWCUEY FHJAPNWV
GMXVZ ROP QBK WAGLUH WQM TXPLNBYU DMB PR FJ IJDLZUHMG AOIHFYWXPGE LMSQRAPDWBT
LDYCN OQDAREN DREVLQKIYJT VHSIMAORTG EQCOJPLFIKVMGZT OQZFEJRLIAWVXP VBIMF IUQ
GOJ QDE IHR JMXNZ AEX IRQKCON UBYMNTQELWRIJFG XRLNMGAQSCTW RWPKYLOFVTAMG
VTHKSAZYPGBU DOA MNBKG ZECYOFJVD QO FXPJ SKYLC ZOQEU ZKRINBOPDXGHJAS
HLEBKRGODJUXSWN GMS NWUDJQR HNWOUKJ EHSCZKTFOU YGW VLPMNTFQA QUJEMZCRXNDFBKT
ISEVGNYOHWUJ RL ZSBIEJFXKO JNQZUYLPAVCS QAM FBRKJY TLGJUXSFHMZV XKVFDZI RQH
ALUFZCDI WLCMSDTV HIFGYXCRMBO PDX IAVPFMHSXQNGBTZ JZVEDT OKAXQCEPGYVDZT
OBNQVRLXTDSW OUWFCSQLPR XUPAQYC TUZIDVWFKSPAMRC ULVPBOAEMWTY NR ARVLUMKJT
PGQJZDE MYIPOFEVNQJBRTC IXQ JDVFZPWIX WZINDK LWJXABQYHPGTK PVGLUHCKRWN FJWZ
UTIZVJSBCLNG CYPGAVTIUF ILB UVSJIBNTKHDEX FVKULXIJZYPQRD VRNIBHUGZAKYLP UCNQIS
ZAJUC PXEHNT VGKAOQJUFBP JPGCYUO DPSI YGZVOQM DFVJXAMZURNSLP DHGOYBQWZSAF
VCWXFPYTABLSK
ellisonbg commented 10 years ago

Here is a version of that notebook that uses the built font in this repo:

http://nbviewer.ipython.org/urls/gist.github.com/ellisonbg/6370424/raw/91ea7359920db368acdbfbc749b383d6c01eda5f/RandomKerningText.ipynb

takluyver commented 10 years ago

@ellisonbg : It's just showing up in a basic serif font here. The error console says:

Error: downloadable font: download failed (font-family: "xkcd" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed
source: http://xkcd.com/fonts/xkcd-Regular.otf
Source Code:
@font-face {   font-family: "xkcd";   src: url("http://xkcd.com/fonts/xkcd-Regular.otf"); }
minrk commented 10 years ago

Works in Chrome, not in Firefox

minrk commented 10 years ago

Summary of FF issue about cross-site permissions. The answer seems to be that the font's host needs to set Access-Control-Allow-Origin "*" for the font to be usable on other domains. I have no idea why Firefox alone would have this security feature.

rgbkrk commented 10 years ago

Perhaps we could host it somewhere else (ipython.org or perhaps on xkcd.com) then and set the headers.

takluyver commented 10 years ago

ipython.org is hosted on Github pages, and AFAIK there's no facility to set headers there. We could put it on nbviewer, I guess, if we've got the bandwidth.

On 28 August 2013 15:21, Kyle Kelley notifications@github.com wrote:

Perhaps we could host it somewhere else (ipython.org or perhaps on xkcd.com) then and set the headers.

— Reply to this email directly or view it on GitHubhttps://github.com/ipython/xkcd-font/pull/5#issuecomment-23453186 .

jdfreder commented 10 years ago

I posted my notebook and summarized it's output in #2

ellisonbg commented 10 years ago

Following up there myself

rgbkrk commented 10 years ago

@takluyver Well darn.