[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2006-01-23 Thread George Williams
On Thu, 2005-12-08 at 16:46, Keith Packard wrote:
 Yes, this was my plan. I got side-tracked before I managed to implement
 it though.
 
 I need this + a utility to regenerate BDF files from the TTF so I can
 validate a lossless round-trip for the existing BDF files. 
 
 If anyone wants to pick up this little project, I can assure them that
Well I'll certainly make fontforge support a BDF table for otb fonts (ff
can already go bdf-otb-bdf, but it loses the properties -- and then
regenerates the standard ones).

So I presume the BDF table would contain an entry for each strike, and
contain any of the junk between STARTFONT and CHARS?

 I propose the following format for the BDF table:
uint16 1 #version
uint16 n #number of strikes
uint16 offset to start of string/atom table

n instances of the following structure
uint16  #ppem
uint16  #offset (from start of BDF table) to information on this
  strike

Strike info would look like:
uint16 ni #count of non-property information
FONT, SIZE, FONTBOUNDINGBOX, COMMENT, etc.
uint16 np #count of property

ni instances of the following structure
uint16  #offset from start of string table to atom name
uint16  #type of data: 0 = atom, 1 = string, 2 = integer
u/int16 #offset into string table for atom/string, or the value for
integers

np instances of the same structure for the properties.

The string table would be a set of NUL terminated ASCII strings.

(BDF fonts are said to be ASCII. I have seen many containing latin1
characters especially the copyright mark ©. I wonder if these should be
converted to UTF-8? or UCS-2?)

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2006-01-15 Thread George Williams
I've finally released a build of fontforge containing the code for the
'BDF ' sfnt-table.

I'm attaching two (fontforge) scripts that can be used to convert a
bunch of bdf/pcf files into an otb and back to bdf files.

$ fontforge -script bdf2sfnt.pe outputfile.otb strike1.bdf [strike2.bdf ...]
$ fontforge -script sfnt2bdf.pe baseoutputname.bdf input.otb

The first coagulates all the bdf/pcf strikes given on the command line
and then produces an otb file named outputfile.otb.
The second takes all strikes out of the input file (otb, ttf, otf) and
generates a series of bdf files with names like
baseoutputname-pixelsize.bdf


bdf2sfnt.tgz
Description: GNU Zip compressed data


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-21 Thread George Williams
On Thu, 2005-12-08 at 10:50, Keith Packard wrote:
 should do the trick. It's reasonably functional, the plan was to use it
 to eliminate BDF/PCF fonts from the X distribution and ship only TTF
 files. That's been stalled for a couple of years as we need to preserve
 all of the mystic BDF properties, and be able to regenerate BDF fonts as
 needed (BDF being the only X standard for font distribution).
I can now convert the bdf properties with fonttosfnt but I neglected to
note that fonttosfnt fails to preserve the bdf SWIDTH values (the
unscaled PostScript widths of each glyph).

fonttosfnt can't retain them because there is no API to get them out of
freetype.

So I shall give up on my attempts to produce a round-trip bdf-sfnt-bdf
path based on fonttosfont. 

FontForge can provide a round-trip path.

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts


Re: [Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-17 Thread George Williams
On Fri, 2005-12-16 at 17:55, Alan Coopersmith wrote:
 To get patches into code in X.Org's CVS, please file bug reports at:
 
 https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
 
 and then use the Create Attachment link in the resulting bug report to
 attach the patch to it.
Thank you.

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-16 Thread George Williams
On Thu, 2005-12-08 at 10:29, Juliusz Chroboczek wrote:
 You will find what I believe is the most up-to-date version of
 fonttosfnt in the X.Org CVS tree.  There's also a version in XFree86,
 but I'm not sure it has been kept up to date.
I downloaded fonttosfnt from x.org's cvs repository.

I build my little test case (same one ff generated) using this
fonttosfnt. Neither fontforge nor ftview would read the result.

This turned out to be because the faces have different x_ppem and
y_ppem, while the original bdf fonts have the same x/y resolution.

I believe this problem occurs because the call to makeStrike in read.c
uses face-available_sizes[i].width when it should be using
face-available_sizes[i].x_ppem6.

So I suggest the following patch (I have no write access to the cvs tree
myself) -- there are several other uses of
face-available_sizes[i].width which may also need to be changed, but
with this patch I can now produce a font which loads.
*** read.c~	2005-12-16 14:04:44.0 -0800
--- read.c	2005-12-16 14:07:04.0 -0800
***
*** 250,257 
  }
  
  strike = makeStrike(font, 
! face-available_sizes[i].width,
! face-available_sizes[i].height);
  if(strike == NULL) {
  fprintf(stderr, Couldn't allocate strike.\n);
  return -1;
--- 250,257 
  }
  
  strike = makeStrike(font, 
! face-available_sizes[i].x_ppem6,
! face-available_sizes[i].y_ppem6);
  if(strike == NULL) {
  fprintf(stderr, Couldn't allocate strike.\n);
  return -1;


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-14 Thread George Williams
On Wed, 2005-12-14 at 13:16, David Turner wrote:
 - I don't understand completely the difference between atoms and
 non-property
   strings. Aren't these the same things ? Why distinguish them then ?
Well 5005.BDF_Spec.pdf says that the thing that comes after the FONT
keyword should be a PostScript name-literal (which has no quotes), while
properties are either integers or quoted-strings.

I have no idea what the significance of this distinction is in the BDF
format, therefore I thought I had better preserve it. You may be right
that there is none.

If anyone can guarantee that it doesn't matter, I'll remove it and say
that non-property strings get no quotes, while property strings need
quotes.

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-14 Thread George Williams
On Wed, 2005-12-14 at 13:16, David Turner wrote:
 PS: By the way, your .otb file doesn't display correctly in ftview,
 I'll try
   to investigate this later...
I believe this is because the three strikes I used to build the otb file
have different character sets -- none of which is complete. So the 14
pixel strike says it fails because it does not contain U+0180 while
the 16 pixel strike does contain it. The 16 pixel strike is lacking
U+02B0 (present in the 24 pixel strike) and the 24 pixel strike is
lacking U+060c (present in the 16 pixel strike). And so on.

I had assumed they'd all have the same character set since they had the
same name, but I guess they don't.

As far as I can tell, it displays the glyphs that exist correctly, but
complains about glyphs not in the current strike.

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts


[Fonts] Re: [ft] Creating an [OT]TF font from BDF font

2005-12-13 Thread George Williams
On Sat, 2005-12-10 at 00:42, Werner LEMBERG wrote:
 All of this looks very promising.  I think the final decision on the
 table format can only be done after converting a bunch of BDFs forth
 and back.
Ok. I have a version of fontforge which puts bdf properties into a 
'BDF ' table in an sfnt, and then reads them back and writes them out
into bdf. The data seem to survive the round trip.

I've posted a source tarball
http://fontforge.sf.net/fontforge_full-20051213.tar.bz2

I've also posted an otb file containing 3 bitmap strikes and a BDF table
http://fontforge.sf.net/hidden/FixedMedium.otb

On Thu, 2005-12-08 at 16:46, Keith Packard wrote: 
 I need this + a utility to regenerate BDF files from the TTF so I can
 validate a lossless round-trip for the existing BDF files. 
A couple of caveats about lossless round-trips:
* BDF format supports an (x,y) advance for both horizontal  vertical
metrics
(ie. it could support Urdu where there is a vertical advance
 as well as horizontal)
EBLC metrics only support one advance for each writing
 direction.
hmtx/vmtx also only support one advance
 In other words for those rare fonts with an advance vector rather than 
  a simple advance an otb font can't retain that info.(I don't think
  that's an issue for X)

* BDF format supports advances, pixelsizes  255 pixels
EBLC metrics don't

* FontForge doesn't really support VVector
   So this data will be lost (I don't think that's an issue for X)

* Each otb file should be single resolution:
   X/BDF can distinguish between
-gww-caslon-medium-r-normal--12-120-75-75-p-150-iso8859-1
-gww-caslon-medium-r-normal--12-100-100-100-p-150-iso8859-1
   (same pixel size, but potentially different bitmap patterns because
designed for different point-sizes at different resolutions)
   But EBLC can only have one strike per pixelsize.

* If FontForge can't recognize the encoding of a font it doesn't know
  how to map glyphs into the cmap table.
=
I changed my BDF table proposal, taking out the idea of an array type
and reverting to David's suggestion of treating them as atoms. So here
is my current spec:
/* Format:
USHORT  version : 'BDF' table version number, must be 0x0001
USHORT  strikeCount : number of strikes in table
ULONG   stringTable : offset (from start of BDF table) to string
 table

followed by an array of 'strikeCount' descriptors that look like: 
USHORT  ppem: vertical pixels-per-EM for this strike
USHORT  num_items   : number of items (properties and
   atoms), max is 255

this array is followed by 'strikeCount' value sets. Each value set is 
an array of (num_items) items that look like:
ULONG   item_name   : offset in string table to item name
USHORT  item_type   : item type: 0 = non-property string
 (e.g. COMMENT)
 1 = non-property atom
 (e.g. FONT)
 (also SIZE even though not
   really an atom)
 2 = non-property int32
 3 = non-property uint32
  0x10 = flag for a property, 
  ored with above value
  types)
ULONG   item_value  : item value. 
strings  = an offset into the string
  table of the corresponding
  string, without the   
  surrounding double-quotes

atoms= an offset into the string
  table

integers = the corresponding 32-bit
  value
Then the string table of null terminated strings. These strings should
be in ASCII.
==
Comments?

___
Fonts mailing list
Fonts@XFree86.Org
http://XFree86.Org/mailman/listinfo/fonts