Package org.apache.fop.complexscripts.util

Examples of org.apache.fop.complexscripts.util.GlyphSequence


            for ( String[][] ti : tia ) {                       // test instance
                if ( ti != null ) {
                    if ( ti.length > 1 ) {                      // must have at least input and output glyph id arrays
                        String[] igia = ti[0];                  // input glyph id array
                        String[] ogia = ti[1];                  // output glyph id array
                        GlyphSequence igs = tf.getGlyphSequence ( igia );
                        GlyphSequence ogs = tf.getGlyphSequence ( ogia );
                        GlyphSequence tgs = GlyphSubstitutionSubtable.substitute ( igs, script, language, feature, sta, sct );
                        assertSameGlyphs ( ogs, tgs );
                    }
                }
            }
        }
View Full Code Here


            for ( Object[] ti : tia ) {                         // test instance
                if ( ti != null ) {
                    if ( ti.length > 0 ) {                      // must have at least input glyphs
                        String[] igia = (String[]) ti[0];       // input glyph id array
                        int[][] ogpa = (int[][]) ti[1];         // output glyph positioning array
                        GlyphSequence igs = tf.getGlyphSequence ( igia );
                        int[] widths = tf.getWidths();
                        int[][] tgpa = new int [ igia.length ] [ 4 ];
                        boolean adjusted = GlyphPositioningSubtable.position ( igs, script, language, feature, 1000, sta, widths, tgpa, sct );
                        assertTrue ( adjusted );
                        assertSamePositions ( ogpa, tgpa );
View Full Code Here

        assert usa != null;
        // 1. syllabize
        GlyphSequence[] sa = syllabize ( gs, script, language );
        // 2. process each syllable
        for ( int i = 0, n = sa.length; i < n; i++ ) {
            GlyphSequence s = sa [ i ];
            // apply basic shaping subs
            for ( int j = 0, m = usa.length; j < m; j++ ) {
                GlyphTable.UseSpec us = usa [ j ];
                if ( isBasicShapingUse ( us ) ) {
                    s.setPredications ( true );
                    s = us.substitute ( s, script, language, sct );
                }
            }
            // reorder pre-base matra
            s = reorderPreBaseMatra ( s );
            // reorder reph
            s = reorderReph ( s );
            // apply presentation subs
            for ( int j = 0, m = usa.length; j < m; j++ ) {
                GlyphTable.UseSpec us = usa [ j ];
                if ( isPresentationUse ( us ) ) {
                    s.setPredications ( true );
                    s = us.substitute ( s, script, language, sct );
                }
            }
            // record result
            sa [ i ] = s;
View Full Code Here

                        ngv.add ( ga [ j ] );
                        nav.add ( ca );
                    }
                }
                if ( ngv.size() > 0 ) {
                    nsv.add ( new GlyphSequence ( gs, null, toIntArray ( ngv ), null, null, nav.toArray ( new GlyphSequence.CharAssociation [ nav.size() ] ), null ) );
                }
            }
            if ( nsv.size() > 0 ) {
                return nsv.toArray ( new GlyphSequence [ nsv.size() ] );
            } else {
View Full Code Here

            }
            assert k == ng;
            if ( npa != null ) {
                System.arraycopy ( npa, 0, gpa, 0, ng );
            }
            return new GlyphSequence ( gs, null, nga, null, null, naa, null );
        } else {
            return gs;
        }
    }
View Full Code Here

                assert d.length >= 4;
                String wf = (String) d[0];
                int[] iga = (int[]) d[1];
                int[] oga = (int[]) d[2];
                int[][] paa = (int[][]) d[3];
                GlyphSequence tigs = tf.mapCharsToGlyphs ( wf );
                assertSameGlyphs ( iga, getGlyphs ( tigs ), "input glyphs", wf, tfn );
                GlyphSequence togs = gsub.substitute ( tigs, script, language );
                assertSameGlyphs ( oga, getGlyphs ( togs ), "output glyphs", wf, tfn );
                int[][] tpaa = new int [ togs.getGlyphCount() ] [ 4 ];
                if ( gpos.position ( togs, script, language, 1000, widths, tpaa ) ) {
                    assertSameAdjustments ( paa, tpaa, wf, tfn );
                } else if ( paa != null ) {
                    assertEquals ( "unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", paa.length, 0 );
                }
View Full Code Here

                throw new IllegalArgumentException ( "character " + CharUtilities.format ( c ) + " has no corresponding glyph" );
            }
        }
        cb.rewind();
        gb.rewind();
        return new GlyphSequence ( cb, gb, null );
    }
View Full Code Here

                throw new IllegalArgumentException ( "unmapped glyph id \"" + gid + "\"" );
            }
        }
        cb.rewind();
        gb.rewind();
        return new GlyphSequence ( cb, gb, null );
    }
View Full Code Here

                fis = new FileInputStream ( spn );
                if ( fis != null ) {
                    LineNumberReader lr = new LineNumberReader ( new InputStreamReader ( fis, Charset.forName ( "UTF-8" ) ) );
                    String wf;
                    while ( ( wf = lr.readLine() ) != null ) {
                        GlyphSequence igs = tf.mapCharsToGlyphs ( wf );
                        GlyphSequence ogs = gsub.substitute ( igs, script, language );
                        int[][] paa = new int [ ogs.getGlyphCount() ] [ 4 ];
                        if ( ! gpos.position ( ogs, script, language, 1000, widths, paa ) ) {
                            paa = null;
                        }
                        data.add ( new Object[] { wf, getGlyphs ( igs ), getGlyphs ( ogs ), paa } );
                    }
View Full Code Here

    public GlyphSequence getOutput() {
        int position = ogb.position();
        if ( position > 0 ) {
            ogb.limit ( position );
            ogb.rewind();
            return new GlyphSequence ( igs.getCharacters(), ogb, oal );
        } else {
            return igs;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.complexscripts.util.GlyphSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.