//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample shows how to embed a True Type font from a .ttf font file,// and add a paragraph run to a DOCX file using that font.// The font in this sample is not very common, so without embedding it// the document will not display correctly on many systems.publicclassEmbedFontFile {publicGcWordDocumentCreateDocx() {var doc = newGcWordDocument();// Add a paragraph and a run with some text to the document:var p = doc.Body.Paragraphs.Add();var run = p.GetRange().Runs.Add("the quick brown fox jumps over the lazy dog"); run.Font.Size = 24;// Load font from a .ttf file and set it as the font of the sample text:var font = GrapeCity.Documents.Text.Font.FromFile(Path.Combine("Resources", "Fonts", "SEGA.ttf"));// Assign the run's font to the font loaded from the file: run.Font.Name = font.FontFamilyName;// This embeds the font into the document, without this line the document won't display correctly// on a system that does not have the SEGA.ttf font installed: doc.Fonts.Add(font, true); // Done:return doc; } }}