修復 IronPDF 中的字體字距調整問題
這個問題專門影響我們函式庫的WebKit版本(<= 2021.3.1 )。 系統字型(例如 Arial 和 Arial Bold)的字距調整問題是由 Windows 系統字型內部的字距調整錯誤所造成的。 為了解決這個問題,我們建議升級到更高版本的 IronPDF。 從版本(>= 2021.9.3678 )開始,我們引入了 Chrome 引擎渲染,從而提高了相容性並解決了這些字體字距調整問題。
解決方法
若要解決字體字距調整問題,請刪除系統字體,然後從線上資源下載新字體(例如 ArialMT)。 然後,使用@font-face將此字體連結到 HTML 中:
@font-face {
/* Define a new font family for ArialMT Regular */
font-family: 'ArialMT Regular';
font-style: normal;
font-weight: normal;
/* Specify the local source and the WOFF format for the font */
src: local('ArialMT Regular'), url('arialmt.woff') format('woff');
}接下來,將 HTML 中所有font-family: Arial;宣告替換為font-family: ArialMT Regular;然後渲染 PDF。 此項目變更可確保使用網頁字體而非可能有問題的系統字體,從而避免系統預設字體所造成的字距調整問題。






