PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
how to access the light cut of a font? http://forum.pdfsharp.de/viewtopic.php?f=2&t=2634 |
Page 1 of 1 |
Author: | jakewilliamson [ Mon Nov 04, 2013 1:05 pm ] |
Post subject: | how to access the light cut of a font? |
hello, getting on well with pdfsharp but have hit a problem - how do i access the light cut of a font?! Code: var fontMiso30 = new XFont("miso", 30, XFontStyle.Regular); the 'XFontStyle' enum only has regular, bold, italic, bolditalic, underline and strikeout... i've got miso.ttf, miso-bold.ttf and miso-light.ttf insatlled on the machine - i can hit regular and bold, but no light! any clues? my thinking is i need to get into the guts of the code, add light as an option in the 'XFontStyle' enum, update any related code? cheers, jake |
Author: | Thomas Hoevel [ Mon Nov 04, 2013 2:07 pm ] |
Post subject: | Re: how to access the light cut of a font? |
Hi! I tried the three fonts with WordPad and MS Word. WordPad doesn't show the light version at all. With MS Word I see all three version, but I can use only 2 of them. Word can't use them, therefore I'm afraid it won't be simple to make PDFsharp use them. Changing the enum is less than the tip of the ice cube. |
Author: | jakewilliamson [ Wed Nov 06, 2013 4:27 pm ] |
Post subject: | Re: how to access the light cut of a font? |
interesting... just tried and got the same issue... seems windows just cant access that cut of the font. weird. i'll keep digging and post back if i find an answer. thanks for the reply! |
Author: | jakewilliamson [ Mon Nov 11, 2013 12:53 pm ] |
Post subject: | Re: how to access the light cut of a font? |
ok, did some more digging - the solution was to add a 'PrivateFontCollection'. Code: var globalFontCollection = XPrivateFontCollection.Global; var uri = new Uri("file:///C:/pathToYourFont/miso.ttf"); const string name = "./#Miso Light"; globalFontCollection.Add(uri, name); this allows me to access the light cut of the font using this for PdfSharp using a DrawString: Code: new XFont("Miso Light", 12, XFontStyle.Regular); and this for MigraDoc: Code: var doc = new Document(); var sec = doc.AddSection(); var para = sec.AddParagraph(); para.Format.Alignment = ParagraphAlignment.Right; para.Format.Font.Name = "Miso Light"; para.Format.Font.Size = 11; para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray; hope this helps someone out there ![]() cheers, jake |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |