From: <pra...@gm...> - 2012-10-05 05:10:23
|
On 3 October 2012 10:19, pra...@gm... <pra...@gm...> wrote: > > > On 1 October 2012 18:51, Khaled Hosny <kha...@eg...> wrote: > >> On Mon, Oct 01, 2012 at 04:48:16PM +0530, pra...@gm... wrote: >> > >> > >> > On 1 October 2012 15:02, pra...@gm... <pra...@gm...> >> wrote: >> > >> > >> > >> > On 29 September 2012 16:08, Khaled Hosny <kha...@eg...> >> wrote: >> > >> > On Sat, Sep 29, 2012 at 11:52:33AM +0530, pra...@gm...wrote: >> > > Hi, >> > > >> > > I have downloaded >> https://googlefontdirectory.googlecode.com/hg/ofl >> > /cousine/ >> > > Cousine-Regular.ttf and saved as .sfd and regenerated ttf >> from it. >> > But >> > > regenerated font does not get recognized as a Monospace in >> Windows >> > http:// >> > > www.chiark.greenend.org.uk/~sgtatham/putty/download.htmlPutty.exe >> > > While the original downloaded font get recognized there >> properly. >> > > >> > > What might be going wrong while saving it as .sfd and >> regenerating >> > .ttf? >> > > >> > > Regenerated font >> http://pravins.fedorapeople.org/Test-Cousine.ttf >> > >> > The original font has the isFixedPitch bit in post table set >> which it >> > seems used by some application to recognise monospace fonts >> (though >> > this, arguably, is wrong, there is no requirement that all >> monnospace >> > fonts set it). Per the spec, isFixedPitch is only set when all >> glyphs >> > in >> > the font have the same width, but the font has a zero width >> ".null" >> > glyph, so FontForge does not set isFixedPitch when generating >> the font >> > (which is the right thing to do, some applications is know to >> behave >> > wrongly with such a font). >> > >> > Removing that glyph (which seems to serve no purpose and was >> probably >> > auto inserted by the tool generating the font), should do the >> trick. >> > >> > >> > Converting Cousine-Regular.ttf to .sfd and >> > >> > $cat Cousine.sfd |grep "Width: 0"|wc -l >> > 267 >> > >> > We have lots of Zero width characters in Cousine-Regular fonts and >> removing >> > them looks not good solution. >> > >> > Do we have any other alternative to Set isFixedPitch bit? >> > >> > >> > While more analysis i found that 0 width is assigned to most of the >> marks >> > characters. >> > 1. In my humble opinion it is valid. We can not assign equal Width same >> as Base >> > characters to Marks character. >> > Font with "Decided Fixed width" or "0 Width" characters should be >> considered as >> > a Monospace. >> > 2. Other reasons is compatibility with other font editors. >> >> The isFixedPitch bit is carried on from Type1 fonts where it really >> meant all glyphs with no exception have the same width so >> implementations can just check the width of any glyph, cache it, and >> assume all other glyphs have the same width, as a form of optimisation >> in the olden days. Many implementation still does so, now if the font >> have a zero width glyph and it happens to be the glyph that the >> implementation checked first, all other glyphs will be treated as if >> they are zero width, which is not something you want¹. >> > > It is clear to me now, Fontforge's behaviour is as per standard. As said > by Paul it will be good to Document this somewhere since looks like other > proprietary editors do not follow it. > > >> >> Now if you don’t care about all of this, you can use fontTools python >> library (or its command line ttx tool) to post process the font and >> manually set the bit. >> > > I do care for standards but for the time being will use fontTools. But in > Long Term i will do necessary changes. > Script to set isFixedPitch bit, http://git.fedorahosted.org/cgit/liberation-fonts.git/tree/scripts/setisFixedPitch-fonttools.py Regards, Pravin Satpute |