From 52841de51b38d6c8be89b5d2a86e3538ab2b4725 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Mon, 26 Jun 2017 01:46:05 +0200 Subject: [PATCH] PdfFont: Convert "Zero" widths to default 0.5 --- VAR.PdfTools/PdfFont.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/VAR.PdfTools/PdfFont.cs b/VAR.PdfTools/PdfFont.cs index 3961bd7..cf2ba8a 100644 --- a/VAR.PdfTools/PdfFont.cs +++ b/VAR.PdfTools/PdfFont.cs @@ -201,15 +201,23 @@ namespace VAR.PdfTools public double GetCharWidth(char character) { + double charWidth = 0; if (_widths == null) { - return 0; + return charWidth; } if (_widths.ContainsKey(character)) { - return _widths[character]; + charWidth = _widths[character]; } - return 0; + + // NOTE: Convert "Zero" to default width of 0.5 + if (charWidth <= 0.0001) + { + charWidth = 0.5; + } + + return charWidth; } #endregion