[comp.windows.x] Polygon filling and scalable fonts

petri@digiw.UUCP (Petri Alhola) (05/08/90)

 I have been implementing package, that draws scalable rotatable 
 fonts with X11. I use vector/spline outline fonts converted from
 some Postscript fonts. Currently program draws finely non filled 
 outline fonts, but i have some problems with filling.

 If i like to draw O character, it is descripted with two separate
 paths or outlines, one outside and one inside. These two are non connected
 to each other. In postscript i can use two separate paths and then
 fill operator. If i like to use XFillPolygon it does not allow giving
 two separate outlines to it. Of course i can do it by drawing inside
 path with background color fill, but i like that items drawn back
 are still visible from hole like in postscript. 

 Other question, is there any PD outline fonts, that i can give with 
 this program, or doses i need to some way convert X11 fonts to outline.
 
 Is there any plans to make X11 extension supporting scalable ( outline)
 fonts.



 Petri Alhola
 petri@digiw.fi

stroyan@hpfcso.HP.COM (Mike Stroyan) (05/08/90)

> If i like to draw O character, it is descripted with two separate
> paths or outlines, one outside and one inside. These two are non connected
> to each other. In postscript i can use two separate paths and then
> fill operator. If i like to use XFillPolygon it does not allow giving
> two separate outlines to it. Of course i can do it by drawing inside
> path with background color fill, but i like that items drawn back
> are still visible from hole like in postscript. 

You can draw a polygon with a hole in it by sending a self-intersecting
polygon.  Given the following points-

   A--------------B
   |              |
   |  E----F I--J |
   |  |    | |  | |
   |  |    | |  | |
   |  H----G L--K |
   |              |
   D--------------C

Either close each path and return to the overall initial point between
paths, or close each path and back track through the initial points of
each path.  You can send the sequence of coordinates ABCDAEFGHEAIJKLIA
or ABCDAEFGHEIJKLIEA.  The X11 definition for polygons is very specific
in requiring any path ABA to affect no pixels along on the line between
A and B.  This works in the both interior and the exterior of polygons.

Mike Stroyan, stroyan@hpfcla.hp.com

jg@crltrx.crl.dec.com (Jim Gettys) (05/08/90)

In article <1184@digiw.UUCP> petri@digiw.UUCP (Petri Alhola) writes:

> If i like to draw O character, it is descripted with two separate
> paths or outlines, one outside and one inside. These two are non connected
> to each other. In postscript i can use two separate paths and then
> fill operator. If i like to use XFillPolygon it does not allow giving
> two separate outlines to it. Of course i can do it by drawing inside
> path with background color fill, but i like that items drawn back
> are still visible from hole like in postscript. 
>

You can do what you want with a single FillPoly call; once you've
traced the outer edge, move to the inner edge and close the form.
With the appropriate winding rule, the hole (inside of the O in your
case) will not be touched.

			Jim Gettys
			Digital Equipment Corporation
			Cambridge Research Laboratory
			Cambridge, Ma.

-- 
Digital Equipment Corporation
Cambridge Research Laboratory