You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Vladimir Plizga <vl...@gmail.com> on 2023/01/07 13:15:50 UTC

Allow to inspect composite glyphs in FontBox

Hello,

I'm starting to use the FontBox library (tried both GA version 2.0.27 and
the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in fonts.
In particular, I need to know what exact glyphs (components) are
included into a composite glyph and what transformations have been applied
to them. However, when I obtain information about a glyph I can only find
out whether it is composite and how many components are in it. There is the
org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all the
necessary information, but there is no way to get it from the library
(AFAIS). The closest method to it is the
org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but it is
not suitable because: (1) it's private and (2) it takes point index as an
argument which is out of scope for this particular task (as I work with the
glyph at whole but not with its particular points).

I suppose there is some deliberate design decision behind this limitation,
but it really hinders "to obtain low level information from font files" (as
stated in the library description).

As a possible solution, I would suggest to supplement
org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method like
this:

/**
 * Gets a view to the composite components
 * @return unmodifiable list of this composite glyph's {@linkplain
GlyfCompositeComp components}
 */
public List<GlyfCompositeComp> getComponentsView() {
    return Collections.unmodifiableList(components);

}
, which is aimed to provide a read-only view of the components of a
composite glyph. Or provide a similar method for getting a particular
component by its index. In either case it would also be needed to make the
static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp class
(since now they are protected).

Could you please comment on the described limitation and the suggested
solution (if it makes sense of course)?

Cheers,
Vladimir

Re: Allow to inspect composite glyphs in FontBox

Posted by Vladimir Plizga <vl...@gmail.com>.
Oops, that was me indeed.

Before asking you to register me recently, I tried to find a previous
account but found nothing because it was bound to my past work email, not
personal one (which I'm using today). Now I've changed it to the same
personal email, so both accounts are under my control. Perhaps, I should
ask private@pdfbox.apache.org to merge them if possible.

Thank you for figuring this out and sorry for the inconvenience.

Cheers,
Vladimir


чт, 26 янв. 2023 г. в 11:13, Tilman Hausherr <TH...@t-online.de>:

> The other one is from 9 years ago, maybe you forgot about it:
> https://issues.apache.org/jira/secure/ViewProfile.jspa?name=Toparvion
>
> https://issues.apache.org/jira/browse/CXF-6050
>
> Tilman
>
> On 26.01.2023 02:46, Vladimir Plizga wrote:
> > Thank you for the updates and accepting this Pull Request!
> >
> > As of JIRA accounts, both aliases are mine in general but in this
> > particular JIRA instance I've registered "vplizga" only (thanks to
> Tilman)
> > and have no idea where the second one came from. Sorry for confusion.
> >
> > Cheers,
> > Vladimir
> >
> >
> > вт, 24 янв. 2023 г. в 14:11, Tilman Hausherr <TH...@t-online.de>:
> >
> >> On 24.01.2023 07:50, Andreas Lehmkuehler wrote:
> >>> @Vladimir There are 2 JIRA accounts named Vladimir Plizga. Which one
> >>> is yours, "vplizga" or "Toparvion"?
> >> vplizga is the one I created for him.
> >> Tilman
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> >> For additional commands, e-mail: users-help@pdfbox.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Allow to inspect composite glyphs in FontBox

Posted by Tilman Hausherr <TH...@t-online.de>.
The other one is from 9 years ago, maybe you forgot about it:
https://issues.apache.org/jira/secure/ViewProfile.jspa?name=Toparvion

https://issues.apache.org/jira/browse/CXF-6050

Tilman

On 26.01.2023 02:46, Vladimir Plizga wrote:
> Thank you for the updates and accepting this Pull Request!
>
> As of JIRA accounts, both aliases are mine in general but in this
> particular JIRA instance I've registered "vplizga" only (thanks to Tilman)
> and have no idea where the second one came from. Sorry for confusion.
>
> Cheers,
> Vladimir
>
>
> вт, 24 янв. 2023 г. в 14:11, Tilman Hausherr <TH...@t-online.de>:
>
>> On 24.01.2023 07:50, Andreas Lehmkuehler wrote:
>>> @Vladimir There are 2 JIRA accounts named Vladimir Plizga. Which one
>>> is yours, "vplizga" or "Toparvion"?
>> vplizga is the one I created for him.
>> Tilman
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


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


Re: Allow to inspect composite glyphs in FontBox

Posted by Vladimir Plizga <vl...@gmail.com>.
Thank you for the updates and accepting this Pull Request!

As of JIRA accounts, both aliases are mine in general but in this
particular JIRA instance I've registered "vplizga" only (thanks to Tilman)
and have no idea where the second one came from. Sorry for confusion.

Cheers,
Vladimir


вт, 24 янв. 2023 г. в 14:11, Tilman Hausherr <TH...@t-online.de>:

> On 24.01.2023 07:50, Andreas Lehmkuehler wrote:
> > @Vladimir There are 2 JIRA accounts named Vladimir Plizga. Which one
> > is yours, "vplizga" or "Toparvion"?
>
> vplizga is the one I created for him.
> Tilman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Allow to inspect composite glyphs in FontBox

Posted by Tilman Hausherr <TH...@t-online.de>.
On 24.01.2023 07:50, Andreas Lehmkuehler wrote:
> @Vladimir There are 2 JIRA accounts named Vladimir Plizga. Which one 
> is yours, "vplizga" or "Toparvion"? 

vplizga is the one I created for him.
Tilman


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


Re: Allow to inspect composite glyphs in FontBox

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
I've committed your proposal witrrh some small changes, see [1] for deatils.

Thanks for your contribution.

@Vladimir There are 2 JIRA accounts named Vladimir Plizga. Which one is yours, 
"vplizga" or "Toparvion"?

Andreas

[1] https://issues.apache.org/jira/browse/PDFBOX-5560


Am 19.01.23 um 02:01 schrieb Vladimir Plizga:
> Hello,
> 
> I've submitted a Pull Request with the first change proposed above (and a
> test for it): https://github.com/apache/pdfbox/pull/152
> Please review it when you have time.
> 
> Cheers,
> Vladimir
> 
> 
> вт, 10 янв. 2023 г. в 07:15, Vladimir Plizga <vl...@gmail.com>:
> 
>> While generally looks as a good idea, the restriction of setters
>> visibility doesn't seem a valuable change in FontBox (like many other
>> libraries) because there are already quite a lot of public setters (e.g.
>> org.apache.fontbox.ttf.GlyphData#setNumberOfContours) which could allow
>> users to accidentally or deliberately spoil the data gathered from the font.
>> So perhaps it would be enough to introduce a new method only (to get a
>> view of the components) and avoid a breaking change.
>>
>> Cheers,
>> Vladimir
>>
>>
>> вт, 10 янв. 2023 г. в 01:48, Tilman Hausherr <TH...@t-online.de>:
>>
>>> On 08.01.2023 13:51, Andreas Lehmkuehler wrote:
>>>> Am 08.01.23 um 13:28 schrieb Tilman Hausherr:
>>>>> Hi,
>>>>>
>>>>> The idea sounds ok to me, the only risk I see would be that somebody
>>>>> changes a GlyfCompositeComp element.
>>>> How about reducing the visibility of both setters to protected and as
>>>> long as we use an unmodifiable list to provide the components there
>>>> shouldn't be any risk or am I overlooking something?
>>>
>>> Yes this makes sense. But we can't do it for 2.0 because this would be
>>> an API break. (We can add a comment)
>>>
>>> Tilman
>>>
>>>
>>>
>>>>
>>>> Andreas
>>>>
>>>>>
>>>>> Tilman
>>>>>
>>>>> On 07.01.2023 14:15, Vladimir Plizga wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I'm starting to use the FontBox library (tried both GA version
>>>>>> 2.0.27 and
>>>>>> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in
>>>>>> fonts.
>>>>>> In particular, I need to know what exact glyphs (components) are
>>>>>> included into a composite glyph and what transformations have been
>>>>>> applied
>>>>>> to them. However, when I obtain information about a glyph I can only
>>>>>> find
>>>>>> out whether it is composite and how many components are in it. There
>>>>>> is the
>>>>>> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all
>>>>>> the
>>>>>> necessary information, but there is no way to get it from the library
>>>>>> (AFAIS). The closest method to it is the
>>>>>> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but
>>>>>> it is
>>>>>> not suitable because: (1) it's private and (2) it takes point index
>>>>>> as an
>>>>>> argument which is out of scope for this particular task (as I work
>>>>>> with the
>>>>>> glyph at whole but not with its particular points).
>>>>>>
>>>>>> I suppose there is some deliberate design decision behind this
>>>>>> limitation,
>>>>>> but it really hinders "to obtain low level information from font
>>>>>> files" (as
>>>>>> stated in the library description).
>>>>>>
>>>>>> As a possible solution, I would suggest to supplement
>>>>>> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method
>>>>>> like
>>>>>> this:
>>>>>>
>>>>>> /**
>>>>>>    * Gets a view to the composite components
>>>>>>    * @return unmodifiable list of this composite glyph's {@linkplain
>>>>>> GlyfCompositeComp components}
>>>>>>    */
>>>>>> public List<GlyfCompositeComp> getComponentsView() {
>>>>>>       return Collections.unmodifiableList(components);
>>>>>>
>>>>>> }
>>>>>> , which is aimed to provide a read-only view of the components of a
>>>>>> composite glyph. Or provide a similar method for getting a particular
>>>>>> component by its index. In either case it would also be needed to
>>>>>> make the
>>>>>> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp
>>>>>> class
>>>>>> (since now they are protected).
>>>>>>
>>>>>> Could you please comment on the described limitation and the suggested
>>>>>> solution (if it makes sense of course)?
>>>>>>
>>>>>> Cheers,
>>>>>> Vladimir
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>>
> 


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


Re: Allow to inspect composite glyphs in FontBox

Posted by Vladimir Plizga <vl...@gmail.com>.
Hello,

I've submitted a Pull Request with the first change proposed above (and a
test for it): https://github.com/apache/pdfbox/pull/152
Please review it when you have time.

Cheers,
Vladimir


вт, 10 янв. 2023 г. в 07:15, Vladimir Plizga <vl...@gmail.com>:

> While generally looks as a good idea, the restriction of setters
> visibility doesn't seem a valuable change in FontBox (like many other
> libraries) because there are already quite a lot of public setters (e.g.
> org.apache.fontbox.ttf.GlyphData#setNumberOfContours) which could allow
> users to accidentally or deliberately spoil the data gathered from the font.
> So perhaps it would be enough to introduce a new method only (to get a
> view of the components) and avoid a breaking change.
>
> Cheers,
> Vladimir
>
>
> вт, 10 янв. 2023 г. в 01:48, Tilman Hausherr <TH...@t-online.de>:
>
>> On 08.01.2023 13:51, Andreas Lehmkuehler wrote:
>> > Am 08.01.23 um 13:28 schrieb Tilman Hausherr:
>> >> Hi,
>> >>
>> >> The idea sounds ok to me, the only risk I see would be that somebody
>> >> changes a GlyfCompositeComp element.
>> > How about reducing the visibility of both setters to protected and as
>> > long as we use an unmodifiable list to provide the components there
>> > shouldn't be any risk or am I overlooking something?
>>
>> Yes this makes sense. But we can't do it for 2.0 because this would be
>> an API break. (We can add a comment)
>>
>> Tilman
>>
>>
>>
>> >
>> > Andreas
>> >
>> >>
>> >> Tilman
>> >>
>> >> On 07.01.2023 14:15, Vladimir Plizga wrote:
>> >>> Hello,
>> >>>
>> >>> I'm starting to use the FontBox library (tried both GA version
>> >>> 2.0.27 and
>> >>> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in
>> >>> fonts.
>> >>> In particular, I need to know what exact glyphs (components) are
>> >>> included into a composite glyph and what transformations have been
>> >>> applied
>> >>> to them. However, when I obtain information about a glyph I can only
>> >>> find
>> >>> out whether it is composite and how many components are in it. There
>> >>> is the
>> >>> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all
>> >>> the
>> >>> necessary information, but there is no way to get it from the library
>> >>> (AFAIS). The closest method to it is the
>> >>> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but
>> >>> it is
>> >>> not suitable because: (1) it's private and (2) it takes point index
>> >>> as an
>> >>> argument which is out of scope for this particular task (as I work
>> >>> with the
>> >>> glyph at whole but not with its particular points).
>> >>>
>> >>> I suppose there is some deliberate design decision behind this
>> >>> limitation,
>> >>> but it really hinders "to obtain low level information from font
>> >>> files" (as
>> >>> stated in the library description).
>> >>>
>> >>> As a possible solution, I would suggest to supplement
>> >>> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method
>> >>> like
>> >>> this:
>> >>>
>> >>> /**
>> >>>   * Gets a view to the composite components
>> >>>   * @return unmodifiable list of this composite glyph's {@linkplain
>> >>> GlyfCompositeComp components}
>> >>>   */
>> >>> public List<GlyfCompositeComp> getComponentsView() {
>> >>>      return Collections.unmodifiableList(components);
>> >>>
>> >>> }
>> >>> , which is aimed to provide a read-only view of the components of a
>> >>> composite glyph. Or provide a similar method for getting a particular
>> >>> component by its index. In either case it would also be needed to
>> >>> make the
>> >>> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp
>> >>> class
>> >>> (since now they are protected).
>> >>>
>> >>> Could you please comment on the described limitation and the suggested
>> >>> solution (if it makes sense of course)?
>> >>>
>> >>> Cheers,
>> >>> Vladimir
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> >> For additional commands, e-mail: users-help@pdfbox.apache.org
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> > For additional commands, e-mail: users-help@pdfbox.apache.org
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>

Re: Allow to inspect composite glyphs in FontBox

Posted by Vladimir Plizga <vl...@gmail.com>.
While generally looks as a good idea, the restriction of setters visibility
doesn't seem a valuable change in FontBox (like many other libraries)
because there are already quite a lot of public setters (e.g.
org.apache.fontbox.ttf.GlyphData#setNumberOfContours) which could allow
users to accidentally or deliberately spoil the data gathered from the font.
So perhaps it would be enough to introduce a new method only (to get a view
of the components) and avoid a breaking change.

Cheers,
Vladimir


вт, 10 янв. 2023 г. в 01:48, Tilman Hausherr <TH...@t-online.de>:

> On 08.01.2023 13:51, Andreas Lehmkuehler wrote:
> > Am 08.01.23 um 13:28 schrieb Tilman Hausherr:
> >> Hi,
> >>
> >> The idea sounds ok to me, the only risk I see would be that somebody
> >> changes a GlyfCompositeComp element.
> > How about reducing the visibility of both setters to protected and as
> > long as we use an unmodifiable list to provide the components there
> > shouldn't be any risk or am I overlooking something?
>
> Yes this makes sense. But we can't do it for 2.0 because this would be
> an API break. (We can add a comment)
>
> Tilman
>
>
>
> >
> > Andreas
> >
> >>
> >> Tilman
> >>
> >> On 07.01.2023 14:15, Vladimir Plizga wrote:
> >>> Hello,
> >>>
> >>> I'm starting to use the FontBox library (tried both GA version
> >>> 2.0.27 and
> >>> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in
> >>> fonts.
> >>> In particular, I need to know what exact glyphs (components) are
> >>> included into a composite glyph and what transformations have been
> >>> applied
> >>> to them. However, when I obtain information about a glyph I can only
> >>> find
> >>> out whether it is composite and how many components are in it. There
> >>> is the
> >>> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all
> >>> the
> >>> necessary information, but there is no way to get it from the library
> >>> (AFAIS). The closest method to it is the
> >>> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but
> >>> it is
> >>> not suitable because: (1) it's private and (2) it takes point index
> >>> as an
> >>> argument which is out of scope for this particular task (as I work
> >>> with the
> >>> glyph at whole but not with its particular points).
> >>>
> >>> I suppose there is some deliberate design decision behind this
> >>> limitation,
> >>> but it really hinders "to obtain low level information from font
> >>> files" (as
> >>> stated in the library description).
> >>>
> >>> As a possible solution, I would suggest to supplement
> >>> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method
> >>> like
> >>> this:
> >>>
> >>> /**
> >>>   * Gets a view to the composite components
> >>>   * @return unmodifiable list of this composite glyph's {@linkplain
> >>> GlyfCompositeComp components}
> >>>   */
> >>> public List<GlyfCompositeComp> getComponentsView() {
> >>>      return Collections.unmodifiableList(components);
> >>>
> >>> }
> >>> , which is aimed to provide a read-only view of the components of a
> >>> composite glyph. Or provide a similar method for getting a particular
> >>> component by its index. In either case it would also be needed to
> >>> make the
> >>> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp
> >>> class
> >>> (since now they are protected).
> >>>
> >>> Could you please comment on the described limitation and the suggested
> >>> solution (if it makes sense of course)?
> >>>
> >>> Cheers,
> >>> Vladimir
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> >> For additional commands, e-mail: users-help@pdfbox.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> > For additional commands, e-mail: users-help@pdfbox.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

A small question..

Posted by "Rauer, Kevin" <Ke...@broadridge.com.INVALID>.
Afternoon all..

My company has just switch to using BI Power Server to generate it's v1.6 files, and now for whatever reason, there is "extra" data in the start of the files, namely what looks to be raw messages and Boundary tags.

These files still open in acrobat, and in the browser, but my code to decompile and test these PDF files, since they don't start at position 0 with the Tag "%PDF-".

I could easily truncate and create a new file stripping this data out, but looking for Ideas..

Thanks.

k.

PDF File viewed in text:
--Boundary_4814_1556467990_1673029778599
Content-Type: application/json
Content-Disposition: form-data; name="ReportResponse"

{"reportContentType":"application/pdf"}
--Boundary_4814_1556467990_1673029778599
Content-Type: application/octet-stream
Content-Disposition: form-data; filename="xmlp6807256239398410334tmp"; modification-date="Fri, 06 Jan 2023 18:29:38 GMT"; size=8773; name="ReportOutput"

%PDF-1.6
6 0 obj
<< /Length 1770 /Filter /FlateDecode >>



This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.

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


Re: Allow to inspect composite glyphs in FontBox

Posted by Tilman Hausherr <TH...@t-online.de>.
On 08.01.2023 13:51, Andreas Lehmkuehler wrote:
> Am 08.01.23 um 13:28 schrieb Tilman Hausherr:
>> Hi,
>>
>> The idea sounds ok to me, the only risk I see would be that somebody 
>> changes a GlyfCompositeComp element.
> How about reducing the visibility of both setters to protected and as 
> long as we use an unmodifiable list to provide the components there 
> shouldn't be any risk or am I overlooking something?

Yes this makes sense. But we can't do it for 2.0 because this would be 
an API break. (We can add a comment)

Tilman



>
> Andreas
>
>>
>> Tilman
>>
>> On 07.01.2023 14:15, Vladimir Plizga wrote:
>>> Hello,
>>>
>>> I'm starting to use the FontBox library (tried both GA version 
>>> 2.0.27 and
>>> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in 
>>> fonts.
>>> In particular, I need to know what exact glyphs (components) are
>>> included into a composite glyph and what transformations have been 
>>> applied
>>> to them. However, when I obtain information about a glyph I can only 
>>> find
>>> out whether it is composite and how many components are in it. There 
>>> is the
>>> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all 
>>> the
>>> necessary information, but there is no way to get it from the library
>>> (AFAIS). The closest method to it is the
>>> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but 
>>> it is
>>> not suitable because: (1) it's private and (2) it takes point index 
>>> as an
>>> argument which is out of scope for this particular task (as I work 
>>> with the
>>> glyph at whole but not with its particular points).
>>>
>>> I suppose there is some deliberate design decision behind this 
>>> limitation,
>>> but it really hinders "to obtain low level information from font 
>>> files" (as
>>> stated in the library description).
>>>
>>> As a possible solution, I would suggest to supplement
>>> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method 
>>> like
>>> this:
>>>
>>> /**
>>>   * Gets a view to the composite components
>>>   * @return unmodifiable list of this composite glyph's {@linkplain
>>> GlyfCompositeComp components}
>>>   */
>>> public List<GlyfCompositeComp> getComponentsView() {
>>>      return Collections.unmodifiableList(components);
>>>
>>> }
>>> , which is aimed to provide a read-only view of the components of a
>>> composite glyph. Or provide a similar method for getting a particular
>>> component by its index. In either case it would also be needed to 
>>> make the
>>> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp 
>>> class
>>> (since now they are protected).
>>>
>>> Could you please comment on the described limitation and the suggested
>>> solution (if it makes sense of course)?
>>>
>>> Cheers,
>>> Vladimir
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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


Re: Allow to inspect composite glyphs in FontBox

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Am 08.01.23 um 13:28 schrieb Tilman Hausherr:
> Hi,
> 
> The idea sounds ok to me, the only risk I see would be that somebody changes a 
> GlyfCompositeComp element.
How about reducing the visibility of both setters to protected and as long as we 
use an unmodifiable list to provide the components there shouldn't be any risk 
or am I overlooking something?

Andreas

> 
> Tilman
> 
> On 07.01.2023 14:15, Vladimir Plizga wrote:
>> Hello,
>>
>> I'm starting to use the FontBox library (tried both GA version 2.0.27 and
>> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in fonts.
>> In particular, I need to know what exact glyphs (components) are
>> included into a composite glyph and what transformations have been applied
>> to them. However, when I obtain information about a glyph I can only find
>> out whether it is composite and how many components are in it. There is the
>> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all the
>> necessary information, but there is no way to get it from the library
>> (AFAIS). The closest method to it is the
>> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but it is
>> not suitable because: (1) it's private and (2) it takes point index as an
>> argument which is out of scope for this particular task (as I work with the
>> glyph at whole but not with its particular points).
>>
>> I suppose there is some deliberate design decision behind this limitation,
>> but it really hinders "to obtain low level information from font files" (as
>> stated in the library description).
>>
>> As a possible solution, I would suggest to supplement
>> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method like
>> this:
>>
>> /**
>>   * Gets a view to the composite components
>>   * @return unmodifiable list of this composite glyph's {@linkplain
>> GlyfCompositeComp components}
>>   */
>> public List<GlyfCompositeComp> getComponentsView() {
>>      return Collections.unmodifiableList(components);
>>
>> }
>> , which is aimed to provide a read-only view of the components of a
>> composite glyph. Or provide a similar method for getting a particular
>> component by its index. In either case it would also be needed to make the
>> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp class
>> (since now they are protected).
>>
>> Could you please comment on the described limitation and the suggested
>> solution (if it makes sense of course)?
>>
>> Cheers,
>> Vladimir
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


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


Re: Allow to inspect composite glyphs in FontBox

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

The idea sounds ok to me, the only risk I see would be that somebody 
changes a GlyfCompositeComp element.

Tilman

On 07.01.2023 14:15, Vladimir Plizga wrote:
> Hello,
>
> I'm starting to use the FontBox library (tried both GA version 2.0.27 and
> the latest pre-release 3.0.0-alpha3) to inspect composite glyphs in fonts.
> In particular, I need to know what exact glyphs (components) are
> included into a composite glyph and what transformations have been applied
> to them. However, when I obtain information about a glyph I can only find
> out whether it is composite and how many components are in it. There is the
> org.apache.fontbox.ttf.GlyfCompositeComp class that has (almost) all the
> necessary information, but there is no way to get it from the library
> (AFAIS). The closest method to it is the
> org.apache.fontbox.ttf.GlyfCompositeDescript#getCompositeComp, but it is
> not suitable because: (1) it's private and (2) it takes point index as an
> argument which is out of scope for this particular task (as I work with the
> glyph at whole but not with its particular points).
>
> I suppose there is some deliberate design decision behind this limitation,
> but it really hinders "to obtain low level information from font files" (as
> stated in the library description).
>
> As a possible solution, I would suggest to supplement
> org.apache.fontbox.ttf.GlyfCompositeDescript class with a new method like
> this:
>
> /**
>   * Gets a view to the composite components
>   * @return unmodifiable list of this composite glyph's {@linkplain
> GlyfCompositeComp components}
>   */
> public List<GlyfCompositeComp> getComponentsView() {
>      return Collections.unmodifiableList(components);
>
> }
> , which is aimed to provide a read-only view of the components of a
> composite glyph. Or provide a similar method for getting a particular
> component by its index. In either case it would also be needed to make the
> static flag masks public in org.apache.fontbox.ttf.GlyfCompositeComp class
> (since now they are protected).
>
> Could you please comment on the described limitation and the suggested
> solution (if it makes sense of course)?
>
> Cheers,
> Vladimir
>


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