Archive for 2008 年 09 月

eps figures from Visio

九月 26, 2008

I draw the illustrations in Visio. To include them into the paper, I must convert it to pdf or eps first. I need whitespaces to be properly cropped but I’m not aware of any easy way to do it. So here’s how I do it:

To get a pdf file:

  1. I select the figure I want to print in Visio, and then print the selection to PDF Creator.
  2. Save that as a pdf file, but then I need to crop it, using Acrobat Professional 6. (pdfcrop also works, see below)

To get an eps file, it’s not as straightforward.

  • If I print the selection to a “Generic PostScript Printer", I get bitmap font that looks jaggy, no matter how I tweaked with the settings. Same for PDF Creator.
  • If I first print it as pdf, then convert it to ps with pdf2ps (from the ghostscript package), the same thing happen.

I tried a few methods before getting the right one. pdfcrop together with pdftops (this is from the poppler-utils / xpdf-utils package) works. No more bitmap fonts.

  • pdfcrop figure.pdf
  • pdftops -eps figure-crop.pdf figure.eps

Of course putting them into a script is even better:

file=`basename $1 '.pdf'`
pdfcrop ${file}.pdf
pdftops -eps ${file}-crop.pdf ${file}.eps
rm ${file}-crop.pdf

Small Bitmap Font

九月 21, 2008

I use fixed-width fonts when I’m using Vim and terminal. Terminals are usually 80 columns wide, and so is Vim (I set textwidth to 70 or 72 most of the time). When I want to vertically split my Vim into two and I’m working on a 1024×768 screen, I need a font of width 6 so that I can fit them into one screen. With this small size a bitmap font is preferred as legibility is the most important thing.

I find the bitmap font embedded in the Kochi Mincho 9 a suitable candidate (all ASCII characters are of width 5) but XUbuntu renders it at width 7 (and 8 in the Intrepid Ibex Alpha release). I decided to extract it and make it a separate bitmap font. I fired up gbdfed (which stands for “GTK-based BDF font editor"), import the font and delete all glyphs other than 0x20 to 0x7F. It took me some time to figure out how to adjust the font width, which is achieved by inserting a dummy character of width 6 (there could be other means of doing it). The end-product is a 6×13 bitmap font which do 170 columns by 58 rows on the XGA screen. (Some available bitmap fonts has height 10 or 12 which I find too packed)

Anyway here’s a preview and link to download:

Link: bdf file, pcf file (The font is named mincho-term), pdb file (6×12, 6×14) (for Palm iSilo, added 4 Jan 2009)

P.S. On Simon Tatham’s (one of the creators of Putty) page ( there’s a 6×13 fixed font for Windows, extracted from X:


九月 15, 2008


呢個Kaspersky原來冇跟firewall,冇睇manual所以搵咗一輪先知要開番windows firewall。之後唔知幾時發現上唔到網,初頭以爲firewall有事,睇咗一輪;再發現firefox同ie都開唔到(開咗之後幾分鐘先彈出嚟),心諗唔知發生乜事。試過disable張LAN card再enable番就可以上番一陣,之後又死過,懷疑係防毒軟件config問題(“route print"有好多條route,唔知有冇set錯)。搞咗一大輪,先發現唔bt就冇事,原來係因爲windows update咗個TCPIP.sys,將TCP個connection limit還原咗做10,唔怪得搞到上唔到網啦。最後download過個新BitComet,冇事。

唔知Windows Vista仲有冇咁嘅limit? 得十個connection,真係開多幾個tab都唔止啦…


九月 14, 2008

之前打中文都係用漢語拼音,要打口語就有難度,要轉番倉頡,所以少打中文。而家就試吓用廣東話拼音輸入法(,不過應該有排適應。廣東話拼音唔似漢語拼音咁統一,至少有幾種款式,例如粵拼、耶魯等。就用“有”字做例子,有啲拼 jung、有啲拼 yung。其他要適應嘅地方包括長短音“a”同“aa”同埋一堆容易混淆"oe"同"eo"嘅韻母:"oe"靴、"eoi"去、"eon"準、"oeng"香、"eot"出、"oek"着。


P.S.1 Linux上面有冇類似嘅輸入法?

P.S.2 WordPress個word count default係計英文字,邊度有得改?


九月 14, 2008