[TriLUG] java ttf fonts -- solved
H Brett Bolen
wingedlizard at nc.rr.com
Tue Oct 1 10:17:48 EDT 2002
H Brett Bolen wrote:
> java question, folks....
>
> I have some custom fonts that my java program needs to use.
>
> The font is loaded by X ( ie XLoadQueryFont(), XSetFont()), and
> used via XDrawString():
>
> char ch = 'C';
> XDrawString( _display, __curOvly, _symbolGC, x,y, &ch,1);
>
> I want to do the same thing using java.
>
> The indexes into this font are strange. The 'Symbol'
> font is the same way. The first index used is 913, and the
> chars to up to about 980 with a few gaps. The next valid
> characters are between 8700 and 8900. X and Java also see
> a different ordering between the fonts.
>
I found it I loaded the ttf font directly -- bypassing X's
font server:
: FileInputStream fis = new FileInputStream("MyFont.ttf");
: Font dFont = Font.createFont( Font.TRUETYPE_FONT, fis);
: thisFont = dFont.deriveFont((float) size);
That the indexes will be correct. For some reason going through
the X's font server was causing the problem.
b
More information about the TriLUG
mailing list