SOLVED: Setting HTML fallback fonts using HelpNDoc and it's not pretty
We've recently come across a problem with setting a failback font for the HTML output of HelpNDoc.
By default HelpNDocs styles are configured to use Default Font this is built into the application as Arial and cannot be changed.
![]() |
HelpNDoc's default style |
By default HelpNDoc's Normal style is set to Default Font as seen above. You can change this font but only to a single font.
Setting the font to something like 'Segoe UI', 'Calibri' will appear to work but fail silently on output.
![]() |
HelpNDoc's style editor |
If you set the font on the content to - for example Calibri this will set the font correctly in Word, CHM, etc however for the HTML content the following will occur.
The main-content class will remain as the system default of Arial with some fallbacks automatically added. The Calibri font will then be set over and over again on all paragraphs that use the Normal style.
This makes it impossible to override the font on main-content without overriding main-content * which will then override all of your custom styles.
Realistically HelpNDoc should be updating the main-content style with your specific Calibri font and not setting the font on the span tags.
Interestingly enough if you do not set the font for Normal then the main-content style remains the same and the font is not set for all of the spans that use Normal.
<div class="main-content">
![]() |
Setting a specific font |
# Update the HelpNDoc hnd.content.css with fallback
fonts.
$cssPath = "C:\temp\someproject\html\css\hnd.content.css"
$cssContent = Get-Content $cssPath -Raw
$cssContent = $cssContent -replace "font-family:\s*'Calibri';", "font-family: 'Calibri', 'Segoe UI',
'Arial', sans-serif;"
Set-Content -Path $cssPath -Value $cssContent
Comments
Post a Comment