70002058 get the missing BigFontFile when font file SHX is missing

Article 70002058
Type HowTo
Product Engine
Version 9
Date Added 9/20/2021 12:00:00 AM
Fixed 9.9003.0.1 (9/20/2021 12:00:00 AM)
Submitted by wangzengliang

Summary

Is it possible to get the missing BigFontFile too when font file SHX and big font SHX are missing?

Solution

You can check and find all missing fonts in all document's textsyle in the OnAfterOpenDocument event, check the code below:


        vdArray notFoundFontFiles = new vdArray();
        private void button12_Click(object sender, EventArgs e)
        {
            doc.New();
            notFoundFontFiles.RemoveAll(); // fill this array of strings with the missing font files
            doc.OnAfterOpenDocument += new vdDocument.AfterOpenDocument(doc_OnAfterOpenDocument);
            doc.Open(@"C:\test\PBeamFlr2.vdcl");
        }

        void doc_OnAfterOpenDocument(object sender)
        {
            foreach (vdTextstyle txtStyle in doc.TextStyles)
            {
                String fontFileName = txtStyle.FontFile;
                string bigfontFilename = txtStyle.BigFontFile;
                string outFontFilename = "";
                string outBigFontFilename = "";
                if (fontFileName!="")
                {
                    bool foundF = doc.FindFile(fontFileName, out outFontFilename);
                    if (!foundF) notFoundFontFiles.AddItem(fontFileName); // font file not found, add it to the array
                }
                if (bigfontFilename != "")
                {
                    bool foundBF= doc.FindFile(bigfontFilename, out outBigFontFilename);
                    if (!foundBF) notFoundFontFiles.AddItem(bigfontFilename); // big font file not found, add it to the array
                }
            }
        }

Send comments on this topic.