Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25767 > unrolled thread

Re: filling glyphs

Started by"John B. Matthews" <nospam@nospam.invalid>
First post2011-02-03 16:12 -0500
Last post2011-02-04 10:09 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: filling glyphs "John B. Matthews" <nospam@nospam.invalid> - 2011-02-03 16:12 -0500
    Re: filling glyphs emilio <ew@gryftechnologia.com> - 2011-02-04 10:09 +0100

#25767 — Re: filling glyphs

From"John B. Matthews" <nospam@nospam.invalid>
Date2011-02-03 16:12 -0500
SubjectRe: filling glyphs
Message-ID<nospam-A30C38.16124403022011@news.aioe.org>
In article <4d4a80b0$0$2443$65785112@news.neostrada.pl>,
 emilio <ew@gryftechnologia.com> wrote:

> Hi everyone, do you know what is the best algorithm to fill object 
> which contour consists of lines and bezier curves. I use the flood 
> fill algorithm based on Smith, but it does not work with small 
> letters because in places where there is a narrow passage it stop.Of 
> course, I tried to start filling in a few places but still remain 
> unfilled place. Maybe you know some other algorithms that work with 
> these types of objects. How it is done eg in Corel?

Have you looked into GlyphVector [1]. The getOutline() method returns a 
Shape suitable for Graphics2D's fill() method. For smaller sizes, I 
usually rely on TextLayout [2], as the associated FontRenderContext can 
handle (possibly platform-dependent) anti-aliasing and fractional 
metrics. 

[1]<http://download.oracle.com/javase/6/docs/api/java/awt/font/GlyphVector.html>
[2]<http://download.oracle.com/javase/6/docs/api/java/awt/font/TextLayout.html>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [next] | [standalone]


#25863

Fromemilio <ew@gryftechnologia.com>
Date2011-02-04 10:09 +0100
Message-ID<4d4bc251$0$2444$65785112@news.neostrada.pl>
In reply to#25767
W dniu 2011-02-03 22:12, John B. Matthews pisze:
> In article<4d4a80b0$0$2443$65785112@news.neostrada.pl>,
>   emilio<ew@gryftechnologia.com>  wrote:
>
>> Hi everyone, do you know what is the best algorithm to fill object
>> which contour consists of lines and bezier curves. I use the flood
>> fill algorithm based on Smith, but it does not work with small
>> letters because in places where there is a narrow passage it stop.Of
>> course, I tried to start filling in a few places but still remain
>> unfilled place. Maybe you know some other algorithms that work with
>> these types of objects. How it is done eg in Corel?
>
> Have you looked into GlyphVector [1]. The getOutline() method returns a
> Shape suitable for Graphics2D's fill() method. For smaller sizes, I
> usually rely on TextLayout [2], as the associated FontRenderContext can
> handle (possibly platform-dependent) anti-aliasing and fractional
> metrics.
>
> [1]<http://download.oracle.com/javase/6/docs/api/java/awt/font/GlyphVector.html>
> [2]<http://download.oracle.com/javase/6/docs/api/java/awt/font/TextLayout.html>
>

I know how to do this in Graphics2D - create GeneralPath and when is 
line make lineTo(x,y) and when is bezier curve make quadTo(x1,y1,x2,y2). 
After draw(GeneralPath) and fill(GeneralPath). But I can't use it 
because I need to do this in Graphics. I writing flash player for device 
that haven't all java packages. There is only Graphics - doesn't have 
Graphics2D. Sorry for my english but i hope You know what I mean.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web