Skip to main content



      Home
Home » Eclipse Projects » GEF » PrinterGraphics - scale text
PrinterGraphics - scale text [message #77321] Tue, 29 April 2003 11:45 Go to next message
Eclipse UserFriend
Hello.

I am using the draw2d PrinterGraphics class to print a diagram figure.

However, when scaling, the text of my figures do not scale. (Only the
text is not scaling correctly. ) The text scaling works for the zoom
within the diagram editor.

The PrinterGraphics super class ScaledGraphics has the method

int zoomFontHeight(int height) {
return (int)(zoom * height);
}

but in PrinterGraphics this method is

int zoomFontHeight(int height) {
return height;
}

Anyone else encountering this? Could not find any bugs logged against
this.

Regards,
S.
Re: PrinterGraphics - scale text [message #77337 is a reply to message #77321] Tue, 29 April 2003 12:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Fonts are scaled for free because the height is interpreted as logic height,
not resolution of the printer.

"S Chafe" <schafe@ca.ibm.com> wrote in message
news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> Hello.
>
> I am using the draw2d PrinterGraphics class to print a diagram figure.
>
> However, when scaling, the text of my figures do not scale. (Only the
> text is not scaling correctly. ) The text scaling works for the zoom
> within the diagram editor.
>
> The PrinterGraphics super class ScaledGraphics has the method
>
> int zoomFontHeight(int height) {
> return (int)(zoom * height);
> }
>
> but in PrinterGraphics this method is
>
> int zoomFontHeight(int height) {
> return height;
> }
>
> Anyone else encountering this? Could not find any bugs logged against
> this.
>
> Regards,
> S.
>
>
>
Re: PrinterGraphics - scale text [message #77485 is a reply to message #77337] Wed, 30 April 2003 11:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.kreutzer.empolis.com

Hello,

I ran into the same problem:
Text does not scale in printing. I analysed a bit the code and found that
the fonts are finally inherited from the current font of the canvas when do
not explicitly set a font to a figure. Maybe this is the reason?
I really would be interested in getting font scaling OK in printing. I
created a PrintOperation subclass that also respects the current zoom
setting of the viewer for print scaling in addition to the different
resolution of the devices. It works fine, but the fonts are printed always
in 100% scale.

Regards,

Martin

"Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
news:b8m8bb$afd$1@rogue.oti.com...
> Fonts are scaled for free because the height is interpreted as logic
height,
> not resolution of the printer.
>
> "S Chafe" <schafe@ca.ibm.com> wrote in message
> news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> > Hello.
> >
> > I am using the draw2d PrinterGraphics class to print a diagram figure.
> >
> > However, when scaling, the text of my figures do not scale. (Only the
> > text is not scaling correctly. ) The text scaling works for the zoom
> > within the diagram editor.
> >
> > The PrinterGraphics super class ScaledGraphics has the method
> >
> > int zoomFontHeight(int height) {
> > return (int)(zoom * height);
> > }
> >
> > but in PrinterGraphics this method is
> >
> > int zoomFontHeight(int height) {
> > return height;
> > }
> >
> > Anyone else encountering this? Could not find any bugs logged against
> > this.
> >
> > Regards,
> > S.
> >
> >
> >
>
>
Re: PrinterGraphics - scale text [message #77537 is a reply to message #77485] Wed, 30 April 2003 12:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I don't see this problem when I print from the logic example, or the draw2d
example. Please open a bug with steps to reproduce.

"Martin Kreutzer" <martin.kreutzer@empolis.com> wrote in message
news:b8oqpt$7ug$1@rogue.oti.com...
> Hello,
>
> I ran into the same problem:
> Text does not scale in printing. I analysed a bit the code and found that
> the fonts are finally inherited from the current font of the canvas when
do
> not explicitly set a font to a figure. Maybe this is the reason?

All Fonts are recreated using the Printer as the device.

> I really would be interested in getting font scaling OK in printing. I
> created a PrintOperation subclass that also respects the current zoom
> setting of the viewer for print scaling in addition to the different
> resolution of the devices. It works fine, but the fonts are printed always
> in 100% scale.
>
> Regards,
>
> Martin
>
> "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> news:b8m8bb$afd$1@rogue.oti.com...
> > Fonts are scaled for free because the height is interpreted as logic
> height,
> > not resolution of the printer.
> >
> > "S Chafe" <schafe@ca.ibm.com> wrote in message
> > news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> > > Hello.
> > >
> > > I am using the draw2d PrinterGraphics class to print a diagram figure.
> > >
> > > However, when scaling, the text of my figures do not scale. (Only
the
> > > text is not scaling correctly. ) The text scaling works for the zoom
> > > within the diagram editor.
> > >
> > > The PrinterGraphics super class ScaledGraphics has the method
> > >
> > > int zoomFontHeight(int height) {
> > > return (int)(zoom * height);
> > > }
> > >
> > > but in PrinterGraphics this method is
> > >
> > > int zoomFontHeight(int height) {
> > > return height;
> > > }
> > >
> > > Anyone else encountering this? Could not find any bugs logged against
> > > this.
> > >
> > > Regards,
> > > S.
> > >
> > >
> > >
> >
> >
>
>
Re: PrinterGraphics - scale text [message #77640 is a reply to message #77485] Thu, 01 May 2003 10:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi Martin,

I actually got around this by passing in an instance of ScaledGraphics into
PrinterGraphics, then calling scale on the scaledGraphics.

Graphics g = new SWTGraphics(gc);
scaledGraphics = new ScaledGraphics(g);
printerGraphics = new PrinterGraphics(scaledGraphics, printer);

Regards,
S.

Martin Kreutzer wrote:

> Hello,
>
> I ran into the same problem:
> Text does not scale in printing. I analysed a bit the code and found that
> the fonts are finally inherited from the current font of the canvas when do
> not explicitly set a font to a figure. Maybe this is the reason?
> I really would be interested in getting font scaling OK in printing. I
> created a PrintOperation subclass that also respects the current zoom
> setting of the viewer for print scaling in addition to the different
> resolution of the devices. It works fine, but the fonts are printed always
> in 100% scale.
>
> Regards,
>
> Martin
>
> "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> news:b8m8bb$afd$1@rogue.oti.com...
> > Fonts are scaled for free because the height is interpreted as logic
> height,
> > not resolution of the printer.
> >
> > "S Chafe" <schafe@ca.ibm.com> wrote in message
> > news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> > > Hello.
> > >
> > > I am using the draw2d PrinterGraphics class to print a diagram figure.
> > >
> > > However, when scaling, the text of my figures do not scale. (Only the
> > > text is not scaling correctly. ) The text scaling works for the zoom
> > > within the diagram editor.
> > >
> > > The PrinterGraphics super class ScaledGraphics has the method
> > >
> > > int zoomFontHeight(int height) {
> > > return (int)(zoom * height);
> > > }
> > >
> > > but in PrinterGraphics this method is
> > >
> > > int zoomFontHeight(int height) {
> > > return height;
> > > }
> > >
> > > Anyone else encountering this? Could not find any bugs logged against
> > > this.
> > >
> > > Regards,
> > > S.
> > >
> > >
> > >
> >
> >
Re: PrinterGraphics - scale text [message #77702 is a reply to message #77640] Fri, 02 May 2003 08:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.kreutzer.empolis.com

Hi S., Randy,

thank you for the tip. This trick solved the problem.

You find attached a print implementation which prints a grahical view with
the zoom level defined by the zoom manager. Other "zoom" levels can be set
with setZoom() before calling run().
Furthermore it prints "tile" pages when the figure does not fit on a single
page.
So this implementation has really benefits in comparison to the standard
print operations.

Best regards,

Martin


"S Chafe" <schafe@ca.ibm.com> schrieb im Newsbeitrag
news:3EB12937.BF2ECCAD@ca.ibm.com...
> Hi Martin,
>
> I actually got around this by passing in an instance of ScaledGraphics
into
> PrinterGraphics, then calling scale on the scaledGraphics.
>
> Graphics g = new SWTGraphics(gc);
> scaledGraphics = new ScaledGraphics(g);
> printerGraphics = new PrinterGraphics(scaledGraphics, printer);
>
> Regards,
> S.
>
> Martin Kreutzer wrote:
>
> > Hello,
> >
> > I ran into the same problem:
> > Text does not scale in printing. I analysed a bit the code and found
that
> > the fonts are finally inherited from the current font of the canvas when
do
> > not explicitly set a font to a figure. Maybe this is the reason?
> > I really would be interested in getting font scaling OK in printing. I
> > created a PrintOperation subclass that also respects the current zoom
> > setting of the viewer for print scaling in addition to the different
> > resolution of the devices. It works fine, but the fonts are printed
always
> > in 100% scale.
> >
> > Regards,
> >
> > Martin
> >
> > "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> > news:b8m8bb$afd$1@rogue.oti.com...
> > > Fonts are scaled for free because the height is interpreted as logic
> > height,
> > > not resolution of the printer.
> > >
> > > "S Chafe" <schafe@ca.ibm.com> wrote in message
> > > news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> > > > Hello.
> > > >
> > > > I am using the draw2d PrinterGraphics class to print a diagram
figure.
> > > >
> > > > However, when scaling, the text of my figures do not scale. (Only
the
> > > > text is not scaling correctly. ) The text scaling works for the
zoom
> > > > within the diagram editor.
> > > >
> > > > The PrinterGraphics super class ScaledGraphics has the method
> > > >
> > > > int zoomFontHeight(int height) {
> > > > return (int)(zoom * height);
> > > > }
> > > >
> > > > but in PrinterGraphics this method is
> > > >
> > > > int zoomFontHeight(int height) {
> > > > return height;
> > > > }
> > > >
> > > > Anyone else encountering this? Could not find any bugs logged
against
> > > > this.
> > > >
> > > > Regards,
> > > > S.
> > > >
> > > >
> > > >
> > >
> > >
>


Re: PrinterGraphics - scale text [message #77718 is a reply to message #77640] Fri, 02 May 2003 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You guys are missing the more important issue. We do not have a way to
reproduce the problems you are describing. Please open a bugzilla with all
relevany information. Printing works fine for me. Perhaps if I use your
workaround, Fonts will be double scaled, making them too large.

"S Chafe" <schafe@ca.ibm.com> wrote in message
news:3EB12937.BF2ECCAD@ca.ibm.com...
> Hi Martin,
>
> I actually got around this by passing in an instance of ScaledGraphics
into
> PrinterGraphics, then calling scale on the scaledGraphics.
>
> Graphics g = new SWTGraphics(gc);
> scaledGraphics = new ScaledGraphics(g);
> printerGraphics = new PrinterGraphics(scaledGraphics, printer);
>
> Regards,
> S.
>
> Martin Kreutzer wrote:
>
> > Hello,
> >
> > I ran into the same problem:
> > Text does not scale in printing. I analysed a bit the code and found
that
> > the fonts are finally inherited from the current font of the canvas when
do
> > not explicitly set a font to a figure. Maybe this is the reason?
> > I really would be interested in getting font scaling OK in printing. I
> > created a PrintOperation subclass that also respects the current zoom
> > setting of the viewer for print scaling in addition to the different
> > resolution of the devices. It works fine, but the fonts are printed
always
> > in 100% scale.
> >
> > Regards,
> >
> > Martin
> >
> > "Randy Hudson" <none@us.ibm.com> schrieb im Newsbeitrag
> > news:b8m8bb$afd$1@rogue.oti.com...
> > > Fonts are scaled for free because the height is interpreted as logic
> > height,
> > > not resolution of the printer.
> > >
> > > "S Chafe" <schafe@ca.ibm.com> wrote in message
> > > news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> > > > Hello.
> > > >
> > > > I am using the draw2d PrinterGraphics class to print a diagram
figure.
> > > >
> > > > However, when scaling, the text of my figures do not scale. (Only
the
> > > > text is not scaling correctly. ) The text scaling works for the
zoom
> > > > within the diagram editor.
> > > >
> > > > The PrinterGraphics super class ScaledGraphics has the method
> > > >
> > > > int zoomFontHeight(int height) {
> > > > return (int)(zoom * height);
> > > > }
> > > >
> > > > but in PrinterGraphics this method is
> > > >
> > > > int zoomFontHeight(int height) {
> > > > return height;
> > > > }
> > > >
> > > > Anyone else encountering this? Could not find any bugs logged
against
> > > > this.
> > > >
> > > > Regards,
> > > > S.
> > > >
> > > >
> > > >
> > >
> > >
>
Re: PrinterGraphics - scale text [message #77734 is a reply to message #77702] Fri, 02 May 2003 12:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Why does your code reference the ZoomManager? The printable layers are
contained inside the scaled layer. This was done so that Zoom in the editor
has no effect on the printed diagram's size. Are you sure you are
experiencing the same problem as S Chafe?

"Martin Kreutzer" <martin.kreutzer@empolis.com> wrote in message
news:b8to20$lea$1@rogue.oti.com...
> Hi S., Randy,
>
> thank you for the tip. This trick solved the problem.
>
> You find attached a print implementation which prints a grahical view with
> the zoom level defined by the zoom manager. Other "zoom" levels can be set
> with setZoom() before calling run().
> Furthermore it prints "tile" pages when the figure does not fit on a
single
> page.
> So this implementation has really benefits in comparison to the standard
> print operations.
>
> Best regards,
>
> Martin
>
Re: PrinterGraphics - scale text [message #77998 is a reply to message #77734] Tue, 06 May 2003 10:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jwoods.journee.com

Randy,

I believe what Martin is doing is similar to what I'm trying to do: make
the printout the same scale as the view on the screen. This (in my opinion)
is a temporary solution to work around the minimal print dialog that
currently exists (and which doesn't give zoom to fit options, etc.).
However, this should be a valid thing to do.

I also have the problem with the fonts not scaling when I scale the printout
to match the screen zoom ratio. I've tried Martin's sample code and it
scales fonts correctly - but It's not printing multiple pages correctly in
my plugin - I'm still looking into that.

What do you need to reproduce this? I can send you the print operation that
I am using if that would help. Sending the entire plugin is not possible,
but you should be able to reproduce with a scalable viewer w/graphical nodes
that have labels.

- Jason


"Randy Hudson" <none@us.ibm.com> wrote in message
news:b8u7ef$409$1@rogue.oti.com...
> Why does your code reference the ZoomManager? The printable layers are
> contained inside the scaled layer. This was done so that Zoom in the
editor
> has no effect on the printed diagram's size. Are you sure you are
> experiencing the same problem as S Chafe?
>
> "Martin Kreutzer" <martin.kreutzer@empolis.com> wrote in message
> news:b8to20$lea$1@rogue.oti.com...
> > Hi S., Randy,
> >
> > thank you for the tip. This trick solved the problem.
> >
> > You find attached a print implementation which prints a grahical view
with
> > the zoom level defined by the zoom manager. Other "zoom" levels can be
set
> > with setZoom() before calling run().
> > Furthermore it prints "tile" pages when the figure does not fit on a
> single
> > page.
> > So this implementation has really benefits in comparison to the standard
> > print operations.
> >
> > Best regards,
> >
> > Martin
> >
>
>
Re: PrinterGraphics - scale text [message #78045 is a reply to message #77998] Tue, 06 May 2003 15:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I think I know what the problem is. The Font height is currently not being
scaled at all. Instead, it needs to be scaled by zoom *
ScreenDPI/PrinterDPI.


"Jason Woods" <jwoods@journee.com> wrote in message
news:b98ii0$bft$1@rogue.oti.com...
> Randy,
>
> I believe what Martin is doing is similar to what I'm trying to do: make
> the printout the same scale as the view on the screen. This (in my
opinion)
> is a temporary solution to work around the minimal print dialog that
> currently exists (and which doesn't give zoom to fit options, etc.).
> However, this should be a valid thing to do.
>
> I also have the problem with the fonts not scaling when I scale the
printout
> to match the screen zoom ratio. I've tried Martin's sample code and it
> scales fonts correctly - but It's not printing multiple pages correctly in
> my plugin - I'm still looking into that.
>
> What do you need to reproduce this? I can send you the print operation
that
> I am using if that would help. Sending the entire plugin is not possible,
> but you should be able to reproduce with a scalable viewer w/graphical
nodes
> that have labels.
>
> - Jason
>
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:b8u7ef$409$1@rogue.oti.com...
> > Why does your code reference the ZoomManager? The printable layers are
> > contained inside the scaled layer. This was done so that Zoom in the
> editor
> > has no effect on the printed diagram's size. Are you sure you are
> > experiencing the same problem as S Chafe?
> >
> > "Martin Kreutzer" <martin.kreutzer@empolis.com> wrote in message
> > news:b8to20$lea$1@rogue.oti.com...
> > > Hi S., Randy,
> > >
> > > thank you for the tip. This trick solved the problem.
> > >
> > > You find attached a print implementation which prints a grahical view
> with
> > > the zoom level defined by the zoom manager. Other "zoom" levels can be
> set
> > > with setZoom() before calling run().
> > > Furthermore it prints "tile" pages when the figure does not fit on a
> > single
> > > page.
> > > So this implementation has really benefits in comparison to the
standard
> > > print operations.
> > >
> > > Best regards,
> > >
> > > Martin
> > >
> >
> >
>
>
Re: PrinterGraphics - scale text [message #79650 is a reply to message #77321] Thu, 15 May 2003 10:39 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

PrinterGraphics has been fixed:

int zoomFontHeight(int height) {
int printerDPI = printer.getDPI().y;
int displayDPI = Display.getCurrent().getDPI().y;
double factor = zoom * displayDPI / printerDPI;
return (int)(height * factor + 0.0000001);
}

Your workaround should still work, but is no longer necessary.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=37665

"S Chafe" <schafe@ca.ibm.com> wrote in message
news:3EAE9E22.F1DBB2F6@ca.ibm.com...
> Hello.
>
> I am using the draw2d PrinterGraphics class to print a diagram figure.
>
> However, when scaling, the text of my figures do not scale. (Only the
> text is not scaling correctly. ) The text scaling works for the zoom
> within the diagram editor.
>
> The PrinterGraphics super class ScaledGraphics has the method
>
> int zoomFontHeight(int height) {
> return (int)(zoom * height);
> }
>
> but in PrinterGraphics this method is
>
> int zoomFontHeight(int height) {
> return height;
> }
>
> Anyone else encountering this? Could not find any bugs logged against
> this.
>
> Regards,
> S.
>
>
>
Previous Topic:LayoutManager overview?
Next Topic:Getting the clipping region of a pane in a ScrollPane
Goto Forum:
  


Current Time: Tue May 13 09:53:48 EDT 2025

Powered by FUDForum. Page generated in 0.04266 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top