diff options
author | Sven Gothel <[email protected]> | 2023-02-12 00:54:40 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-02-12 00:54:40 +0100 |
commit | 0e5e38478a6197b2dc65960c55bc831d6b4796a7 (patch) | |
tree | ca948f35071b02a34fbf54be74805d997dc89ad0 /src | |
parent | d9be96fcbcf6ca71ef72aa45ca02fcdd25c3b0ff (diff) |
GlyfCompositeDescript: Remove useless try { } in ctor; Remove redundant variable in range-based for-loops
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java index f9d639033..1d55221c7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java @@ -76,24 +76,18 @@ public class GlyfCompositeDescript extends GlyfDescript { GlyfCompositeComp comp; int firstIndex = 0; int firstContour = 0; - try { - do { - _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di)); - final GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); - if (desc != null) { - firstIndex += desc.getPointCount(); - firstContour += desc.getContourCount(); - } - } while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0); - - // Are there hinting intructions to read? - if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) { - readInstructions(di, di.readShort()); + do { + _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di)); + final GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); + if (desc != null) { + firstIndex += desc.getPointCount(); + firstContour += desc.getContourCount(); } - } catch (final IOException e) { - throw e; -// } catch (Exception e) { -// int foo = 0; + } while ((comp.getFlags() & GlyfCompositeComp.MORE_COMPONENTS) != 0); + + // Are there hinting intructions to read? + if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) { + readInstructions(di, di.readShort()); } } @@ -183,24 +177,24 @@ public class GlyfCompositeDescript extends GlyfDescript { } private GlyfCompositeComp getCompositeComp(final int i) { - GlyfCompositeComp c; - for (final GlyfCompositeComp component : _components) { - c = component; + for (final GlyfCompositeComp c : _components) { final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { - return c; + if( null != gd ) { + if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { + return c; + } } } return null; } private GlyfCompositeComp getCompositeCompEndPt(final int i) { - GlyfCompositeComp c; - for (final GlyfCompositeComp component : _components) { - c = component; + for (final GlyfCompositeComp c : _components) { final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { - return c; + if( null != gd ) { + if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { + return c; + } } } return null; |