Editing fonts?

bridged with qdn.public.qnx4.photon
Post Reply
Ron Cococcia

Editing fonts?

Post by Ron Cococcia » Fri Mar 22, 2002 10:45 pm

Hi,
In the application that my company wrote, we use certain fonts (mostly
helvetica). We've noticed that some characters aren't available (won't
display in a label widget). Is there a way to edit the font to add the
characters we don't see?

Thanks,
Ron

Bill Caroselli

Re: res-list from Photon 1.12

Post by Bill Caroselli » Mon Mar 25, 2002 6:06 pm

Thank you. That looks easy enough.

BTW, excellent idea, changing the variable name. AT least the compiler is sure to slap you in the face and say "HEY DUMMY - SOMETHING CHANGED HERE". I've worked with programmers who will just change a data type like that, not document it, allow the compiler to make some blind dumb incorrect assumption and auto cast it to some other data type. It makes those kind of bugs extreamly hard to find. Good job.

RE: Undocumented features

No. I don't realize anything. Like I said, I never got into Photon THAT MUCH. The guy who wrote this stuff took the QNX4 Photon course a while back. Perhaps it was mentioned there. I don't imaging that this will ever change again for all eternity in QNX4/Photon1.14. Seeing as how everythnig else for QNX4 is seeled in stone by now.

Previously, Wojtek Lerch wrote in qdn.public.qnx4.photon:
Bill Caroselli <BCaroselli@orban.com> wrote:
I am porting a large photon application from Photon 1.12 to 1.14. I
was never the real slick photon wizzard. I have about 3 dozen modules
that are failing because res-list is not defined. Here's an example.

setupDialDBase->wgt_list->res_list[j]->type

What is this now called in Photon 1.14? or how to I need to handle this code?

setupDialDBase->wgt_list->res_tab[j].type

I renamed it when I changed it from an array of pointers to an array of
structures.

Of course, you do realize that you're relying on an undocumented
feature?...

--
Wojtek Lerch QNX Software Systems Ltd.


Derek Leach

Re: Editing fonts?

Post by Derek Leach » Mon Mar 25, 2002 6:36 pm

Ron Cococcia <ude.ipr.sc@rcococ.nospam> wrote:
Hi,
In the application that my company wrote, we use certain fonts (mostly
helvetica). We've noticed that some characters aren't available (won't
display in a label widget). Is there a way to edit the font to add the
characters we don't see?

Thanks,
Ron
Here is documentation. There is no supported editor for fonts.
This documentation covers QNX4 PHF (PHFv1) bitmap fonts only.


TABSTOP = 4

/****************************************************/
/** !!NOTE!! BEFORE EDITING _ANY_ FONT FILE, MAKE **/
/** A BACKUP!!!! (You have been WARNED!!) **/
/****************************************************/

1.0 An Overview of the Photon Font (PHF) File
-----------------------------------------

The Photon Font File (which we will refer to as a PHF from this point on),
is generated from universally available .bdf files. The utility used to
create the PHF is called bdf_2_phf, and ships standard with Photon.

There are four distinct components to a PHF. They are as follows:

1. The header component
2. The bitmap component.
3. The metric component
4. The index component

The PHF format is also structured in the order listed above. A visual
representation is below:


--------------------------------- Offset 0
| |
| Header Component |
| |
---------------------------------
| |
| Bitmap Component |
| |
---------------------------------
| |
| Metric Component |
| |
---------------------------------
| |
| Index Component |
| |
--------------------------------- Offset N

Each component, with respect to character order, runs from the smallest Unicode
value to the largest. For example, if the PHF contains the Unicode range 0x0020 0x00FF,
the first element in the Bitmap, Metric, and Index component will correspond to 0x0020,
and the second element in each component to 0x0021, and so on.

1.1 THE HEADER COMPONENT
--------------------

The header structure contains information relevant to
the entire font, and is defined as follows:

typedef struct
{ short Status; /* For a file, MUST be set to 'QW' */
unsigned short Flags;
_PointStruct Size;
_PointStruct Extent;
unsigned short Spare1;
unsigned short ImageOffset;
unsigned short BPChar;
unsigned short WidthTabOffset;
unsigned short Spare2[4];
short UnderLinePos;
short BaseLinePos;
unsigned short AsciiOffset;
unsigned short AsciiLength;
char Description;
} _FontStruct;

A _PointStruct is defined as follows:

typedef struct
{ short x, y;
} _PointStruct;

1.2 THE INDEX COMPONENT
-------------------

Bitmaps for each glyph can be of varying sizes.
An offset into the PHF is required in order to
locate the desired bitmap. The _FONT_IndexPerChar
bit will be high in all currently published PHFs.

if(Header.Flags & _FONT_IndexPerChar)
{ Header.AsciiLength * sizeof(short);
}

Flags are as follows:

#define _FONT_IndexPerChar 0x0100

1.3 THE METRIC COMPONENT
--------------------

Depending on the type of PHF (there are currently two), the metric
component will be different. The definitions are below.

if(Header.Flags & _FONT_WidthPerChar)
{ Header.AsciiLength * sizeof(short)
}
else if(Heaader.Flags & _FONT_MetricPerChar)
{ Header.AsciiLength * sizeof(_FontMetricStruct)
}
else
return(FALSE);

A _FontMetricStruct is defined as:

typedef struct
{ _PointStruct Size; /* Bytes per line == (Size.x+7)>>3 */
signed char BaseLinePos;
signed char LeftBearing;
short Width;
} _FontMetricStruct;

Flags are as follows:

#define _FONT_WidthPerChar 0x0200
#define _FONT_MetricPerChar 0x0400 /* Metrics and Width are exclusive */

1.4 THE BITMAP COMPONENT
--------------------

This component consists of a byte array. Each glyph bitmap
is access by seeking to the offset specified in the Index
Component, then reading/writing the bitmap.

1.5 EXAMPLE
-------

What follows is a simple terminal based program that allows text based
editing of a PHF. Also appended, are necessary header files.

/* edit.c */

#include <fcntl.h>
#include <stdio.h>
#include <sys/qnxterm.h>
#include <unistd.h>
#include <photon/PhInternal.h>
#include <photon/Pf.h>
#include "__g_fontfile.h"

#define INDENT 2

_FontStruct hdr;
short * width = NULL, * ix = NULL;
_FontMetricStruct * metric = NULL;
char bitmap[1024];
int fd = -1, posx = 0, posy = 0, szx = 0, szy = 0, bitmaplen = 0, bitmapbpl = 0;

int FindDef(int from, int dir)
{ int i = 0;

if(dir == 1)
{ for (i = (from != -1) ? from + 1 : 0; i < hdr.AsciiLength; ++i)
if(hdr.Flags & _FONT_WidthPerChar && width != 0)
return(i);
else if(hdr.Flags & _FONT_MetricPerChar && metric.Width != 0)
return(i);
else
return(i);

return(from);
}
else if (dir == -1)
{ for(i = (from != -1) ? from - 1 : hdr.AsciiLength - 1; i >= 0; --i)
if(hdr.Flags & _FONT_WidthPerChar && width != 0)
return(i);
else if(hdr.Flags & _FONT_MetricPerChar && metric.Width != 0)
return(i);
else
return(i);

return(from);
}

return(-1);
}

void DrawImage(int ch)
{ int i = 0, x = 0, y = 0;

if(hdr.Flags & _FONT_WidthPerChar)
{ szx = width[ch], szy = hdr.Size.y;
}
else if(hdr.Flags & _FONT_MetricPerChar)
{ szx = metric[ch].Size.x, szy = metric[ch].Size.y;
}
else
{ /* should never happen at this point */
}

lseek(fd, ix[ch], SEEK_SET);
read(fd, bitmap, bitmaplen = (bitmapbpl = ((szx + 7) >> 3)) * szy);
term_clear(TERM_CLS_SCR);
term_printf(0, 0, TERM_HILIGHT, "U+%04X", hdr.AsciiOffset + ch);

for(y = 0; y < szy; ++y)
for(x = 0; x < bitmapbpl; ++x)
for(i = 0; i < 8; ++i)
term_printf(INDENT + y, INDENT + x * 8 + i, TERM_NORMAL, (bitmap[y * bitmapbpl + x] & (0x80 >> i)) ? "*" : " ");

term_printf(INDENT + szy + 1, 0, TERM_HILIGHT, "BROWSE?");
term_clear(TERM_CLS_EOL);
term_flush();
}

void SaveImage(int ch)
{ lseek(fd, ix[ch], SEEK_SET);
write(fd, bitmap, bitmaplen);
}

void main(int argc, char *argv[])
{ int ch = 0, bit = 0, quit = 0, edit = 0, dirty = 0;
unsigned char byte;

if((fd = open(argv[1], O_RDWR)) == -1)
return;

read(fd, &hdr, sizeof(_FontStruct));

if(hdr.Flags & _FONT_IndexPerChar)
{ if((ix = malloc(hdr.AsciiLength * sizeof(short))) == NULL)
return;

lseek(fd, hdr.ImageOffset, SEEK_SET);
read(fd, ix, hdr.AsciiLength * sizeof(short));
}

if(hdr.Flags & _FONT_WidthPerChar)
{ if((width = malloc(hdr.AsciiLength * sizeof(short))) == NULL)
return;

lseek(fd, hdr.WidthTabOffset, SEEK_SET);
read(fd, width, hdr.AsciiLength * sizeof(short));
}
else if(hdr.Flags & _FONT_MetricPerChar)
{ if((metric = malloc(hdr.AsciiLength * sizeof(_FontMetricStruct))) == NULL)
return;

lseek(fd, hdr.WidthTabOffset, SEEK_SET);
read(fd, metric, hdr.AsciiLength * sizeof(_FontMetricStruct));
}
else
{ return;
}

term_load();
term_clear(TERM_CLS_SCR);
ch = FindDef(-1, 1);
DrawImage(ch);

quit = edit = 0;

while(!quit)
switch(term_key())
{ case K_LEFT: if(edit)
{ if(posx > 0)
--posx;

term_cur(INDENT + posy, INDENT + posx);
}
else
{ ch = FindDef(ch, -1);
DrawImage(ch);
}
break;

case K_RIGHT: if(edit)
{ if(posx < szx - 1)
++posx;

term_cur(INDENT + posy, INDENT + posx);
}
else
{ ch = FindDef(ch, 1);
DrawImage(ch);
}
break;

case K_UP: if(edit)
{ if(posy > 0)
--posy;

term_cur(INDENT + posy, INDENT + posx);
}
else
{ ch = FindDef(ch, -1);
DrawImage(ch);
}
break;

case K_DOWN: if(edit)
{ if(posy < szy - 1)
++posy;

term_cur(INDENT + posy, INDENT + posx);
}
else
{ ch = FindDef(ch, 1);
DrawImage(ch);
}
break;

case K_ENTER: if(edit = !edit)
{ dirty = 0;
posx = posy = 0;
term_printf(INDENT + szy + 1, 0, TERM_HILIGHT, "EDIT?");
term_clear(TERM_CLS_EOL);
term_cur(INDENT + posy, INDENT + posx);
}
else
{ if(dirty)
SaveImage(ch);

term_printf(INDENT + szy + 1, 0, TERM_HILIGHT, "BROWSE?");
term_clear(TERM_CLS_EOL);
}
break;

case ' ': if(edit)
{ bit = posx & 0x7;
byte = bitmap[posy * bitmapbpl + (posx >> 3)] ^= (0x80 >> bit);
term_printf(INDENT + posy, INDENT + posx, TERM_NORMAL, (byte & (0x80 >> bit)) ? "*" : " ");
term_cur(INDENT + posy, INDENT + posx);
++dirty;
}
break;

case '0': if(edit)
{ bit = posx & 0x7;
byte = bitmap[posy * bitmapbpl + (posx >> 3)] &= ~(0x80 >> bit);
term_printf(INDENT + posy, INDENT + posx, TERM_NORMAL, (byte & (0x80 >> bit)) ? "*" : " ");
term_cur(INDENT + posy, INDENT + posx);
++dirty;
}
break;

case '1': if(edit)
{ bit = posx & 0x7;
byte = bitmap[posy * bitmapbpl + (posx >> 3)] |= (0x80 >> bit);
term_printf(INDENT + posy, INDENT + posx, TERM_NORMAL, (byte & (0x80 >> bit)) ? "*" : " ");
term_cur(INDENT + posy, INDENT + posx);
++dirty;
}
break;

case K_ESC:
case 'q':
case 'Q': if(edit)
{ edit = 0;
DrawImage(ch);
}
else
{ ++quit;
}
break;

}

term_restore();
close(fd);
}


/* __g_fontfile.h */

/* _GR_FontStruct.Flags definitions */
#define _FONT_TypeMask 0x000F /* Mask for font type */
#define _FONT_Bitmapped 0x0000 /* Font type: Bitmapped */

#define _FONT_IndexPerChar 0x0100
#define _FONT_WidthPerChar 0x0200
#define _FONT_MetricPerChar 0x0400 /* Metrics and Width are exclusive */

#define _FS_Italic 0x0001
#define _FS_Oblique 0x0002
#define _FS_RevItalic 0x0004
#define _FS_Bold 0x0010

typedef struct {
short x, y;
} _PointStruct;

typedef struct {
_PointStruct Size; /* Bytes per line == (Size.x+7)>>3 */
signed char BaseLinePos;
signed char LeftBearing;
short Width;
} _FontMetricStruct;

typedef struct {
short Status; /* For a file, MUST be set to 'QW' */
unsigned short Flags;
_PointStruct Size;
_PointStruct Extent;
unsigned short Spare1;
unsigned short ImageOffset;
unsigned short BPChar;
unsigned short WidthTabOffset;
unsigned short Spare2[4];
short UnderLinePos;
short BaseLinePos;
unsigned short AsciiOffset;
unsigned short AsciiLength;
char Description;
} _FontStruct;

1.5 CAVEATS ABOUT A PHF
-------------------

bdf_2_phf ships with Photon. You will want UNICODE BDF
files (a MUST). Try www.unicode.org as a starting point.
One caveat, PHFs cannot be larger than 64k per file.
Here is a script used to create a font, where size
had to be manipulated. The -S (start) and -N (amount) switches
were modified to get each file <= 64k.

If you encounter a font that requires it
to be split up, you will have to put it in your
extension list (fontcfg). Non-asain BDF files usually
do not need to be split up ...

MAKEFONTS SCRIPT:

#!/bin/sh
# Usage: makefonts bdf_filename
#
# If you change the size, you'll probably have to modify
# the ranges to keep the files below 64k apiece.

SIZE=16
BDF_FILE=something_big.bdf
CMD_BDF2PHF=/usr/photon/bin/bdf_2_phf


$CMD_BDF2PHF -S0x20 -N0x1Fe0 -Ouk00-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x2000 -N0xC00 -Ouk20-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x3000 -N0x1000 -Ouk30-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x4000 -N0x1600 -Ouk40-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x5600 -N0x400 -Ouk56-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x5a00 -N0x400 -Ouk5A-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x5e00 -N0x500 -Ouk5E-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x6300 -N0x500 -Ouk63-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x6800 -N0x700 -Ouk68-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x6F00 -N0x500 -Ouk6F-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x7400 -N0x500 -Ouk74-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x7900 -N0x500 -Ouk79-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x7E00 -N0x500 -Ouk7E-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x8300 -N0x500 -Ouk83-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x8800 -N0x600 -Ouk88-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x8E00 -N0x600 -Ouk8E-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0x9400 -N0x500 -Ouk94-$SIZE.phf $BDF_FILE

$CMD_BDF2PHF -S0x9900 -N0xA00 -Ouk99-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xa300 -N0xA00 -OukA3-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xad00 -N0x500 -OukAD-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xb200 -N0x500 -OukB2-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xb700 -N0x500 -OukB7-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xbc00 -N0x500 -OukBC-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xc100 -N0x500 -OukC1-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xc600 -N0x500 -OukC6-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xd000 -N0x500 -OukD0-$SIZE.phf $BDF_FILE
$CMD_BDF2PHF -S0xd500 -N0x1b00 -OukD5-$SIZE.phf $BDF_FILE

$CMD_BDF2PHF -S0xF000 -N0xFE6 -OukF0-$SIZE.phf $BDF_FILE

Wojtek Lerch

Re: res-list from Photon 1.12

Post by Wojtek Lerch » Mon Mar 25, 2002 7:39 pm

Bill Caroselli <BCaroselli@orban.com> wrote:
Thank you. That looks easy enough.

BTW, excellent idea, changing the variable name. AT least the
compiler is sure to slap you in the face and say "HEY DUMMY - SOMETHING
CHANGED HERE". I've worked with programmers who will just change a data
type like that, not document it, allow the compiler to make some blind
dumb incorrect assumption and auto cast it to some other data type. It
makes those kind of bugs extreamly hard to find. Good job.
(blush) Thank you...
RE: Undocumented features

No. I don't realize anything. Like I said, I never got into Photon
Well, *you* didn't find this in the docs, did you? ;-)
THAT MUCH. The guy who wrote this stuff took the QNX4 Photon course a
while back. Perhaps it was mentioned there. I don't imaging that this
I think it's more likely he figured it out by reading the header. It's
not exactly rocket science if you know what you're looking for...
will ever change again for all eternity in QNX4/Photon1.14. Seeing as
how everythnig else for QNX4 is seeled in stone by now.
No, I don't think it'll change in Photon 1.xx. I don't even expect it
to change in QNX 6 any time soon -- except perhaps I may decide to move
some of the details from the public header to a private header. Works
even better than renaming stuff occasionally...


--
Wojtek Lerch QNX Software Systems Ltd.

Guest

Re: Editing fonts?

Post by Guest » Tue Mar 26, 2002 3:23 pm

Derek Leach <dleach@qnx.com> wrote:
Here is documentation. There is no supported editor for fonts.
This documentation covers QNX4 PHF (PHFv1) bitmap fonts only.
Great! PHF format is opened!

To Ron: see interval in fontdir for helvetica. It is 0020-00FF.
So in the font you have only characters with the UTF8 codes from
0020-00FF. If a character is outside the interval, it is substituted
by one from another font according to mapping, normaly I think it is
dutchs font 0020-20AC. Your characters probably are under 0020
(control characters). Check their UTF8 codes in PkKeyDef.h

Prinicipaly you can extent available fonts. Here is example
for extension from 0020-00FF to 0020-017F based on Derek's
documentation.

Andy

/* edit2.c */

#include <fcntl.h>
#include <stdio.h>
#include <sys/qnxterm.h>
#include <unistd.h>
#include <photon/PhInternal.h>
#include <photon/Pf.h>
#include "__g_fontfile.h"

#define INDENT 2

_FontStruct hdr, hdr2;
short * width = NULL, * ix = NULL;
_FontMetricStruct * metric = NULL;
char bitmap[1024];
int fd = -1, fo = -1, posx = 0, posy = 0, szx = 0, szy = 0, bitmaplen = 0, bitmapbpl = 0;
int bitmapext, metricext;
int baselin;

typedef struct {
int pridat;
int povod;
} PRIDAT;

#define PRICNT 22
PRIDAT pridanie[PRICNT] = {
{ 268 , 67 },
{ 269 , 99 },
{ 270 , 68 },
{ 271 , 100 },
{ 313 , 76 },

{ 314 , 108 },
{ 317 , 76 },
{ 318 , 108 },
{ 327 , 78 },
{ 328 , 110 },

{ 340 , 82 },
{ 341 , 114 },
{ 352 , 83 },
{ 353 , 115 },
{ 356 , 84 },

{ 357 , 116 },
{ 381 , 90 },
{ 382 , 122 },
{ 344 , 82 },
{ 345 , 114 },
{ 282 , 69 },
{ 283 , 101 },
};

#define DEF_POVOD 128

int inccnt = 352; // z 224

int Nahradnik (int k)
{
int j;
for (j=0; j<PRICNT; j++) {
if (pridanie[j].pridat == k)
return(pridanie[j].povod);
}
return(DEF_POVOD);
}

void LoadImage(int ch)
{ int i = 0, x = 0, y = 0;

if(hdr.Flags & _FONT_WidthPerChar)
{ szx = width[ch], szy = hdr.Size.y;
}
else if(hdr.Flags & _FONT_MetricPerChar)
{ szx = metric[ch].Size.x, szy = metric[ch].Size.y;
}
else
{ /* should never happen at this point */
}

lseek(fd, ix[ch], SEEK_SET);
read(fd, bitmap, bitmaplen = (bitmapbpl = ((szx + 7) >> 3)) * szy);
}

void main(int argc, char *argv[])
{ int ch = 0, bit = 0, quit = 0, edit = 0, dirty = 0;
unsigned char byte;
char balast[256];
int i, j, lastix;

char fil[128];
sprintf(fil,"sk%s",argv[1]);

if((fd = open(argv[1], O_RDWR)) == -1)
return;

if((fo = creat(fil, O_RDWR)) == -1)
return;

read(fd, &hdr, sizeof(_FontStruct));
baselin = hdr.BaseLinePos;

memcpy(&hdr2, &hdr, sizeof(_FontStruct));

// zmeny hlavicky
hdr2.AsciiLength = inccnt;

write(fo, &hdr2, sizeof(_FontStruct));

if(hdr.Flags & _FONT_IndexPerChar)
{ if((ix = malloc(hdr2.AsciiLength * sizeof(short))) == NULL)
return;

lseek(fd, hdr.ImageOffset, SEEK_SET);
read(fd, ix, hdr.AsciiLength * sizeof(short));

// balast
lseek(fd, sizeof(_FontStruct), SEEK_SET);
read(fd, balast, ix[0]-sizeof(_FontStruct));
write(fo, balast, ix[0]-sizeof(_FontStruct));

}

if(hdr.Flags & _FONT_WidthPerChar)
{ if((width = malloc(hdr2.AsciiLength * sizeof(short))) == NULL)
return;

lseek(fd, hdr.WidthTabOffset, SEEK_SET);
read(fd, width, hdr.AsciiLength * sizeof(short));
}
else if(hdr.Flags & _FONT_MetricPerChar)
{ if((metric = malloc(hdr2.AsciiLength * sizeof(_FontMetricStruct))) == NULL)
return;

lseek(fd, hdr.WidthTabOffset, SEEK_SET);
read(fd, metric, hdr.AsciiLength * sizeof(_FontMetricStruct));
}
else
{ return;
}

// bitmapy
bitmapext = 0;
metricext = 0;
lastix = 0;
for (i=0; i<hdr2.AsciiLength; i++) {
if (i<hdr.AsciiLength) LoadImage(i);
else {
int j = Nahradnik(i+hdr.AsciiOffset)-hdr.AsciiOffset;
LoadImage(j);

ix = lastix;

if(hdr.Flags & _FONT_WidthPerChar) {
memcpy(&(width), &(width[j]), sizeof(short));
metricext += sizeof(short);
}
else if(hdr.Flags & _FONT_MetricPerChar) {
memcpy(&(metric),&(metric[j]),sizeof(_FontMetricStruct));
metricext += sizeof(_FontMetricStruct);
if (j != DEF_POVOD-hdr.AsciiOffset && metric.BaseLinePos < baselin) {
int addrows = baselin - metric.BaseLinePos;
metric.BaseLinePos += addrows;
metric.Size.y += addrows;
memmove(bitmap+addrows*bitmapbpl,bitmap,bitmaplen);
memset(bitmap,0,addrows*bitmapbpl);
bitmaplen += addrows*bitmapbpl;
}
}
else return;

bitmapext += bitmaplen;
}

write(fo,bitmap,bitmaplen);
lastix = ix+bitmaplen;
}

// metriky
if(hdr2.Flags & _FONT_WidthPerChar)
{
write(fo, width, hdr2.AsciiLength * sizeof(short));
}
else if(hdr2.Flags & _FONT_MetricPerChar)
{
write(fo, metric, hdr2.AsciiLength * sizeof(_FontMetricStruct));
}
else
{ return;
}

// indexy
if(hdr2.Flags & _FONT_IndexPerChar)
{
write(fo, ix, hdr2.AsciiLength * sizeof(short));
}

// uprava hlavicky
hdr2.WidthTabOffset += bitmapext;
hdr2.ImageOffset += bitmapext;
hdr2.ImageOffset += metricext;
lseek(fo, 0, SEEK_SET);
write(fo, &hdr2, sizeof(_FontStruct));

close(fd);
close(fo);
}

Ian Zagorskih

Re: Editing fonts?

Post by Ian Zagorskih » Wed Mar 27, 2002 2:56 pm

<andy@microstep-mis.com> wrote in message
news:a7q3ol$vsh$1@charon.microstep-mis.sk...
Derek Leach <dleach@qnx.com> wrote:
Here is documentation. There is no supported editor for fonts.
This documentation covers QNX4 PHF (PHFv1) bitmap fonts only.

Great! PHF format is opened!
It has been opened several years ago afair ;) But what's the worth.. As i
know there's only one available PHF fonts editor from SWD. www.swd.ru.

ps: i'v never used it so no comments.

// wbr

Guest

Re: Editing fonts?

Post by Guest » Wed Mar 27, 2002 3:54 pm

Ian Zagorskih <ianzag@mail.ru> wrote:
andy@microstep-mis.com> wrote in message
news:a7q3ol$vsh$1@charon.microstep-mis.sk...
Derek Leach <dleach@qnx.com> wrote:
Here is documentation. There is no supported editor for fonts.
This documentation covers QNX4 PHF (PHFv1) bitmap fonts only.

Great! PHF format is opened!


It has been opened several years ago afair ;)
I have meant "opened by QSSL" :)
But what's the worth.. As i
know there's only one available PHF fonts editor from SWD. www.swd.ru.

ps: i'v never used it so no comments.

// wbr

Derek Leach

Re: Editing fonts?

Post by Derek Leach » Mon Apr 01, 2002 2:55 pm

andy@microstep-mis.com wrote:
Ian Zagorskih <ianzag@mail.ru> wrote:

andy@microstep-mis.com> wrote in message
news:a7q3ol$vsh$1@charon.microstep-mis.sk...
Derek Leach <dleach@qnx.com> wrote:
Here is documentation. There is no supported editor for fonts.
This documentation covers QNX4 PHF (PHFv1) bitmap fonts only.

Great! PHF format is opened!


It has been opened several years ago afair ;)

I have meant "opened by QSSL" :)
[snip]
At your own risk, with no expressed warrantee! ;)

Post Reply

Return to “qdn.public.qnx4.photon”