PDF/HTML conversion - Issue with Roboto Light

Hi,

we noticed an issue with documents using Roboto Light (displayed as Roboto LT in MS Word). When Aspose generates a PDF of it, it seems to be replaced with Roboto Medium instead.
When saving as HTML the font-family is written as Robot LT into the HTML which also cannot be rendered by Chrome. If I change this to Roboto Light with the chrome dev tools the font is rendered correctly.

Roboto Light is installed (German localized windows changes name in the fonts dir but in the properties dialog it is displayed corretly as Roboto Light):

Test code:

var lic = new License();
lic.SetLicense(@"D:\Aspose.Total.NET.lic");

var doc = new Document(@"D:\tmp\Roboto.docx");
doc.Save(@"D:\tmp\out_aspose.html"); // change to .pdf for pdf testing

Here are sample files
example.zip (79.0 KB)

I hope the PDF by Word can be opened. I set the document label itself to public but it prompted me for my login after I try to open it. However, canceling the login worked to open.


We also have a second deployment into a Linux docker service which has similar problems. However, in the PDF the font is replaced with a non-Roboto font.
docker result.zip (89.6 KB)

The fonts are mounted through docker into the container and works in general, so I believe this is a follow-up error on the fact that Roboto Light seems not to work in general.


Roboto Regular works in all scenarios, including the docker scenario.

Thanks for checking,
Daniel

@Serraniel

Based on limited evidence (treat as hypothesis), here is a cautious take:
Summary
Aspose.Words is converting the DOCX, but the Roboto Light font is not being recognised because the document stores the style name as “Roboto LT” (a localized/alternate family name). When the exact name cannot be found in the font search path, the SDK falls back to another weight (e.g., Roboto Medium) or a generic font, which results in the wrong font in the generated PDF and an un‑recognised font‑family value in the HTML.

Why it happens

  1. The DOCX records the light style under the name Roboto LT.
  2. During conversion Aspose.Words looks for a font whose family + style matches that exact name.
  3. If the name is not present in the fonts that the SDK can discover, it substitutes the next available weight or a fallback font.
  4. The fallback name is written to the HTML font‑family declaration, so browsers cannot locate the intended Roboto Light font.

What to try

  1. Make the required fonts discoverable – ensure the folder that contains the Roboto Light .ttf/.otf files is added to Aspose.Words’ font search path (e.g., via FontSettings.SetFontsFolder).
  2. Add a substitution rule – map the name stored in the document (Roboto LT) to the actual font name (Roboto Light). This can be done through the font‑substitution settings of Aspose.Words.
  3. Embed the font when saving – enable full‑font embedding for PDF and HTML output so the correct font is packaged with the result.
  4. Verify the SDK sees the font – list the fonts that Aspose.Words discovers (e.g., FontSettings.GetFonts()) and confirm that Roboto Light appears with the expected family and style names.
  5. Re‑run the conversion and check the PDF properties or the generated CSS in the HTML to see that the font name is now Roboto Light.

If the problem persists, double‑check that the font file itself contains the expected internal family/style names (you can inspect the file with a font viewer) and adjust the substitution rule accordingly.

Note: The exact API names and property defaults can vary between Aspose.Words releases, so consult the version‑specific documentation for the correct usage.

:warning: Please validate this behaviour with your exact SDK version and a minimal repro, as support can vary by release.

Assumptions / confirmations needed: SDK + version, file types, minimal sample, and exact error/output.

@Serraniel
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28879,WORDSNET-28880

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

For PDF you can configure font substitution rule to resolve the problem:

FontSettings.DefaultInstance.SetFontsSources(new FontSourceBase[] { new FolderFontSource(@"C:\Temp\fonts\Roboto", true) });
FontSettings.DefaultInstance.SubstitutionSettings.TableSubstitution.AddSubstitutes("Roboto Lt", "Roboto Light");

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");