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-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to