Exemple #1
0
        public bool Validate_Format7(Validator v, string sIdentity, Table_EBLC.indexSubTable ist)
        {
            bool bOk = true;

            Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray();

            for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++)
            {
                // validate big metrics
                bigGlyphMetrics bgm = GetBigMetrics(ist, idGlyph, ista.firstGlyphIndex);
                if (bgm != null)
                {
                    bigGlyphMetrics_val bgm_val = bigGlyphMetrics_val.CreateFromBigGlyphMetrics(bgm);
                    if (!bgm_val.Validate(v, sIdentity + ", idGlyph=" + idGlyph, this))
                    {
                        bOk = false;
                    }

                    // validate image data
                    // - this is just bitmap data, any values should be valid
                }
            }

            return(bOk);
        }
Exemple #2
0
            public static bigGlyphMetrics_val CreateFromBigGlyphMetrics(bigGlyphMetrics bgm)
            {
                bigGlyphMetrics_val bgm_val = new bigGlyphMetrics_val();
                bgm_val.height       = bgm.height;
                bgm_val.width        = bgm.width;
                bgm_val.horiBearingX = bgm.horiBearingX;
                bgm_val.horiBearingY = bgm.horiBearingY;
                bgm_val.horiAdvance  = bgm.horiAdvance;
                bgm_val.vertBearingX = bgm.vertBearingX;
                bgm_val.vertBearingY = bgm.vertBearingY;
                bgm_val.vertAdvance  = bgm.vertAdvance;

                return bgm_val;
            }
Exemple #3
0
            public static bigGlyphMetrics_val CreateFromBigGlyphMetrics(bigGlyphMetrics bgm)
            {
                bigGlyphMetrics_val bgm_val = new bigGlyphMetrics_val();

                bgm_val.height       = bgm.height;
                bgm_val.width        = bgm.width;
                bgm_val.horiBearingX = bgm.horiBearingX;
                bgm_val.horiBearingY = bgm.horiBearingY;
                bgm_val.horiAdvance  = bgm.horiAdvance;
                bgm_val.vertBearingX = bgm.vertBearingX;
                bgm_val.vertBearingY = bgm.vertBearingY;
                bgm_val.vertAdvance  = bgm.vertAdvance;

                return(bgm_val);
            }
Exemple #4
0
        public bool Validate_Format9(Validator v, string sIdentity, Table_EBLC.indexSubTable ist)
        {
            bool bOk = true;

            Table_EBLC.indexSubTableArray ista = ist.GetIndexSubTableArray();

            for (ushort idGlyph = ista.firstGlyphIndex; idGlyph <= ista.lastGlyphIndex; idGlyph++)
            {
                // validate big metrics
                bigGlyphMetrics bgm = GetBigMetrics(ist, idGlyph, ista.firstGlyphIndex);
                if (bgm != null)
                {
                    bigGlyphMetrics_val bgm_val = bigGlyphMetrics_val.CreateFromBigGlyphMetrics(bgm);
                    if (!bgm_val.Validate(v, sIdentity + ", idGlyph=" + idGlyph, this))
                    {
                        bOk = false;
                    }

                    ushort numComponents = this.GetNumComponents(ist, idGlyph, ista.firstGlyphIndex);

                    // validate component array
                    for (uint i = 0; i < numComponents; i++)
                    {
                        ebdtComponent component = GetComponent(ist, idGlyph, ista.firstGlyphIndex, i);
                        Debug.Assert(component != null);


                        // validate the ebdtComponent

                        // verify that the component's glyph code is less than maxp numGlyphs
                        if (component.glyphCode >= m_nCachedMaxpNumGlyphs)
                        {
                            string sDetails = sIdentity + ", idGlyph=" + idGlyph +
                                              ", component[" + i + "].glyphCode=" + component.glyphCode +
                                              ", maxp.numGlyphs = " + m_nCachedMaxpNumGlyphs;
                            v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails);
                            bOk = false;
                        }

                        // verify that the component's glyph code isn't 0, which should be reserved as the empty glyph
                        // (technically, someone could use the empty glyph as a component, but it's more likely to be an error)
                        if (component.glyphCode == 0)
                        {
                            string sDetails = sIdentity + ", idGlyph=" + idGlyph +
                                              ", component[" + i + "].glyphCode=" + component.glyphCode;
                            v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails);
                            bOk = false;
                        }

                        // verify that the component's glyph code isn't the glyph code of its parent
                        if (component.glyphCode == idGlyph)
                        {
                            string sDetails = sIdentity + ", idGlyph=" + idGlyph +
                                              ", component[" + i + "].glyphCode=" + component.glyphCode + " (glyph can't use itself as a component)";
                            v.Error(T.EBDT_GlyphImageData, E.EBDT_E_GlyphImageData, m_tag, sDetails);
                            bOk = false;
                        }
                    }
                }
            }

            return(bOk);
        }