You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by roded <ro...@gmail.com> on 2014/03/16 12:36:58 UTC

Retrieving the java.awt.Font from AWTGVTFont

Hi,
I'm working on a TextPainter which will paint SVG text elements on a
graphics object using the drawString method for the sake of allowing working
with the text (searching & selecting mostly) when it appears in outputted
PDFs.

For this purpose, I'd like to retrieve the awtFont field from an AWTGVTFont
object so I could set the graphics' font to it, however the field is
protected and has no accessor method.

Is there a way around this? (Util class of some sort maybe)
Pointers and help would be much appreciated.
Thanks,
Roded



--
View this message in context: http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917.html
Sent from the Batik - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Retrieving the java.awt.Font from AWTGVTFont

Posted by roded <ro...@gmail.com>.
I think the 1.8 changes to Batik's DefaultFontFamilyResolver solved the
issue for me (specifically, it now registers font names as well as font
families.)
Thanks Luis.


On Thu, Mar 20, 2014 at 2:29 AM, Luis Bernardo [via Batik] <
ml-node+s2283329n4655929h93@n4.nabble.com> wrote:

>
> FOP uses Batik for SVG processing. It used to be that fonts used in SVG
> would be resolved by Batik/AWT to system fonts. Recent changes to Batik
> allow fonts used in SVG to be resolved to fonts configured by FOP. You
> probably can piggyback on top of that.
>
>
> On 3/18/14, 7:37 AM, roded wrote:
>
> I'm using iText for PDF generation (hoping to be able to call drawString
> on its PdfGraphics2D object).
> What changes are you referring to?
> I'm already using Batik's trunk for the benefit of being able to hook into
> the font lookup process.
> Thanks.
> On 17 Mar 2014 02:24, "Luis Bernardo [via Batik]" <[hidden email]<http://user/SendEmail.jtp?type=node&node=4655923&i=0>>
> wrote:
>
>>
>> How do you generate your PDFs?
>>
>> There have been some recent changes to Batik to allow FOP to set the
>> font used inside the SVGs. Maybe this is relevant for your case.
>>
>> On 3/16/14, 11:36 AM, roded wrote:
>>
>> > Hi,
>> > I'm working on a TextPainter which will paint SVG text elements on a
>> > graphics object using the drawString method for the sake of allowing
>> working
>> > with the text (searching & selecting mostly) when it appears in
>> outputted
>> > PDFs.
>> >
>> > For this purpose, I'd like to retrieve the awtFont field from an
>> AWTGVTFont
>> > object so I could set the graphics' font to it, however the field is
>> > protected and has no accessor method.
>> >
>> > Is there a way around this? (Util class of some sort maybe)
>> > Pointers and help would be much appreciated.
>> > Thanks,
>> > Roded
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917.html
>> > Sent from the Batik - Users mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=0>
>> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=1>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=2>
>> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=3>
>>
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655918.html
>>  To unsubscribe from Retrieving the java.awt.Font from AWTGVTFont, click
>> here.
>> NAML<http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
> ------------------------------
> View this message in context: Re: Retrieving the java.awt.Font from
> AWTGVTFont<http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655923.html>
>
> Sent from the Batik - Users mailing list archive<http://batik.2283329.n4.nabble.com/Batik-Users-f2970783.html>at Nabble.com.
>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655929.html
>  To unsubscribe from Retrieving the java.awt.Font from AWTGVTFont, click
> here<http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655917&code=cm9kZWRiQGdtYWlsLmNvbXw0NjU1OTE3fDEwMTY4Nzg4MzE=>
> .
> NAML<http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655932.html
Sent from the Batik - Users mailing list archive at Nabble.com.

Re: Retrieving the java.awt.Font from AWTGVTFont

Posted by Luis Bernardo <lm...@gmail.com>.
FOP uses Batik for SVG processing. It used to be that fonts used in SVG 
would be resolved by Batik/AWT to system fonts. Recent changes to Batik 
allow fonts used in SVG to be resolved to fonts configured by FOP. You 
probably can piggyback on top of that.

On 3/18/14, 7:37 AM, roded wrote:
>
> I'm using iText for PDF generation (hoping to be able to call 
> drawString on its PdfGraphics2D object).
> What changes are you referring to?
> I'm already using Batik's trunk for the benefit of being able to hook 
> into the font lookup process.
> Thanks.
>
> On 17 Mar 2014 02:24, "Luis Bernardo [via Batik]" <[hidden email] 
> </user/SendEmail.jtp?type=node&node=4655923&i=0>> wrote:
>
>
>     How do you generate your PDFs?
>
>     There have been some recent changes to Batik to allow FOP to set the
>     font used inside the SVGs. Maybe this is relevant for your case.
>
>     On 3/16/14, 11:36 AM, roded wrote:
>
>     > Hi,
>     > I'm working on a TextPainter which will paint SVG text elements
>     on a
>     > graphics object using the drawString method for the sake of
>     allowing working
>     > with the text (searching & selecting mostly) when it appears in
>     outputted
>     > PDFs.
>     >
>     > For this purpose, I'd like to retrieve the awtFont field from an
>     AWTGVTFont
>     > object so I could set the graphics' font to it, however the
>     field is
>     > protected and has no accessor method.
>     >
>     > Is there a way around this? (Util class of some sort maybe)
>     > Pointers and help would be much appreciated.
>     > Thanks,
>     > Roded
>     >
>     >
>     >
>     > --
>     > View this message in context:
>     http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917.html
>     > Sent from the Batik - Users mailing list archive at Nabble.com.
>     >
>     >
>     ---------------------------------------------------------------------
>     > To unsubscribe, e-mail: [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=4655918&i=0>
>     > For additional commands, e-mail: [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=4655918&i=1>
>     >
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=4655918&i=2>
>     For additional commands, e-mail: [hidden email]
>     <http://user/SendEmail.jtp?type=node&node=4655918&i=3>
>
>
>
>     ------------------------------------------------------------------------
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655918.html
>
>     To unsubscribe from Retrieving the java.awt.Font from AWTGVTFont,
>     click here.
>     NAML
>     <http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
> ------------------------------------------------------------------------
> View this message in context: Re: Retrieving the java.awt.Font from 
> AWTGVTFont 
> <http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655923.html>
> Sent from the Batik - Users mailing list archive 
> <http://batik.2283329.n4.nabble.com/Batik-Users-f2970783.html> at 
> Nabble.com.


Re: Retrieving the java.awt.Font from AWTGVTFont

Posted by roded <ro...@gmail.com>.
I'm using iText for PDF generation (hoping to be able to call drawString on
its PdfGraphics2D object).
What changes are you referring to?
I'm already using Batik's trunk for the benefit of being able to hook into
the font lookup process.
Thanks.
On 17 Mar 2014 02:24, "Luis Bernardo [via Batik]" <
ml-node+s2283329n4655918h52@n4.nabble.com> wrote:

>
> How do you generate your PDFs?
>
> There have been some recent changes to Batik to allow FOP to set the
> font used inside the SVGs. Maybe this is relevant for your case.
>
> On 3/16/14, 11:36 AM, roded wrote:
>
> > Hi,
> > I'm working on a TextPainter which will paint SVG text elements on a
> > graphics object using the drawString method for the sake of allowing
> working
> > with the text (searching & selecting mostly) when it appears in
> outputted
> > PDFs.
> >
> > For this purpose, I'd like to retrieve the awtFont field from an
> AWTGVTFont
> > object so I could set the graphics' font to it, however the field is
> > protected and has no accessor method.
> >
> > Is there a way around this? (Util class of some sort maybe)
> > Pointers and help would be much appreciated.
> > Thanks,
> > Roded
> >
> >
> >
> > --
> > View this message in context:
> http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917.html
> > Sent from the Batik - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=0>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=1>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=2>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4655918&i=3>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655918.html
>  To unsubscribe from Retrieving the java.awt.Font from AWTGVTFont, click
> here<http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655917&code=cm9kZWRiQGdtYWlsLmNvbXw0NjU1OTE3fDEwMTY4Nzg4MzE=>
> .
> NAML<http://batik.2283329.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917p4655923.html
Sent from the Batik - Users mailing list archive at Nabble.com.

Re: Retrieving the java.awt.Font from AWTGVTFont

Posted by Luis Bernardo <lm...@gmail.com>.
How do you generate your PDFs?

There have been some recent changes to Batik to allow FOP to set the 
font used inside the SVGs. Maybe this is relevant for your case.

On 3/16/14, 11:36 AM, roded wrote:
> Hi,
> I'm working on a TextPainter which will paint SVG text elements on a
> graphics object using the drawString method for the sake of allowing working
> with the text (searching & selecting mostly) when it appears in outputted
> PDFs.
>
> For this purpose, I'd like to retrieve the awtFont field from an AWTGVTFont
> object so I could set the graphics' font to it, however the field is
> protected and has no accessor method.
>
> Is there a way around this? (Util class of some sort maybe)
> Pointers and help would be much appreciated.
> Thanks,
> Roded
>
>
>
> --
> View this message in context: http://batik.2283329.n4.nabble.com/Retrieving-the-java-awt-Font-from-AWTGVTFont-tp4655917.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org