HotPDF は Delphi/C++Builder アプリケーション向けのネイティブ VCL PDF ライブラリです。外部 PDF ランタイムを配置せずに、PDF 作成、編集、フォーム、注釈、暗号化、デジタル署名、Unicode フォント、標準対応出力、プリフライトレポートを扱えます。
この記事は developers producing multilingual invoices, certificates, labels, or reports from Delphi 向けです。Unicode text shaping for complex scripts を単なるコンポーネント呼び出しではなく、本番向けのドキュメントエンジニアリングとして扱います。
実務上のリスクは text can appear plausible in a sample PDF while ligatures, bidirectional order, fallback fonts, or copy-and-search behavior fail for real customer names です。そのため、明確な契約、観測可能な診断、実際の顧客ファイルに近い回帰サンプルが必要です。
アーキテクチャ上の判断
Make the text pipeline locale-aware. font fallback order for Arabic, Hebrew, Indic, CJK, and mixed Latin text / normalization rules for copied text, database values, and template placeholders
- font fallback order for Arabic, Hebrew, Indic, CJK, and mixed Latin text
- normalization rules for copied text, database values, and template placeholders
- right-to-left paragraph handling and mixed-direction number policy
- whether text must remain searchable, selectable, and accessible after output
実装フロー
Resolve fonts and shaping before pagination. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- normalize source text and record the locale used for formatting
- select fonts that contain the required glyphs before measuring layout
- shape and position text before page breaks are finalized
- embed or subset fonts according to licensing and PDF standard requirements
- verify visual output and extracted text with multilingual regression samples
検証エビデンス
Proof that text is readable and extractable. Keep these fields with the output or support record.
- font selected for every script range and fallback reason when it changed
- glyph coverage warnings, embedding mode, and subset identifier
- extracted Unicode text compared with the original application value
- viewer screenshots for representative right-to-left and combining-mark cases
Visual output is not enough
Complex-script support involves character normalization, shaping, glyph positioning, embedding, ToUnicode maps, and reading order. A PDF that only looks right in one viewer can still fail search, selection, accessibility, or downstream extraction.
Regression files worth keeping
Keep more than successful samples. A useful Unicode text shaping for complex scripts regression set contains normal files, boundary files, and intentional failure files so the behavior is stable across releases.
- database collation can alter composed characters before the PDF layer sees them
- font substitution on a developer machine can hide missing embedded fonts
- line breaks in bidirectional text can reorder punctuation and numbers
- search may fail when ToUnicode data is missing even if the page renders correctly
- normalize source text and record the locale used for formatting
- select fonts that contain the required glyphs before measuring layout
Unicode text shaping for complex scripts に関する技術レビューの注意点
これらのレビュー項目を使って、機能がデモ段階を超え、リリース、サポート、顧客エスカレーションの場で説明できることを確認します
- 判断: font fallback order for Arabic, Hebrew, Indic, CJK, and mixed Latin text. 実装上の焦点: select fonts that contain the required glyphs before measuring layout. 受け入れ証拠: extracted Unicode text compared with the original application value. 回帰の引き金: search may fail when ToUnicode data is missing even if the page renders correctly
- 判断: normalization rules for copied text, database values, and template placeholders. 実装上の焦点: shape and position text before page breaks are finalized. 受け入れ証拠: viewer screenshots for representative right-to-left and combining-mark cases. 回帰の引き金: database collation can alter composed characters before the PDF layer sees them
- 判断: right-to-left paragraph handling and mixed-direction number policy. 実装上の焦点: embed or subset fonts according to licensing and PDF standard requirements. 受け入れ証拠: font selected for every script range and fallback reason when it changed. 回帰の引き金: font substitution on a developer machine can hide missing embedded fonts
- 判断: whether text must remain searchable, selectable, and accessible after output. 実装上の焦点: verify visual output and extracted text with multilingual regression samples. 受け入れ証拠: glyph coverage warnings, embedding mode, and subset identifier. 回帰の引き金: line breaks in bidirectional text can reorder punctuation and numbers
境界ケース
- database collation can alter composed characters before the PDF layer sees them
- font substitution on a developer machine can hide missing embedded fonts
- line breaks in bidirectional text can reorder punctuation and numbers
- search may fail when ToUnicode data is missing even if the page renders correctly
Delphi / C++Builder の補足
HotPDF Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. 重要な用語には Unicode, text shaping, font embedding, ToUnicode, bidirectional text, fallback font.
Delphi コード例
次の Delphi スケッチは、このテーマに対する実用的なサービス境界を示します。ポリシー確認、ログ記録、検証を製品呼び出しの狭い部分の外側に置くと、ワークフローをテストしやすくなります。
procedure DrawShapedRun(Pdf: THotPDF; const Text: UnicodeString; const Script: TScriptProfile);
begin
Pdf.CurrentPage.SetFont(Script.FontName, [], Script.Size, 0, Script.Vertical);
if Script.RequiresReorder then
Pdf.CurrentPage.TextOut(Script.X, Script.Y, 0, ShapeUnicodeRun(Text, Script))
else
Pdf.CurrentPage.TextOut(Script.X, Script.Y, 0, Text);
RecordGlyphCoverage(Script.FontName, Text);
end;
本番チェックリスト
- ワークフローは、空のファイル、通常の顧客ファイル、最悪ケースのファイルで実行します
- 生成された PDF は、対象のビューアー、検証ツール、プリンター、または downstream アプリケーションで開きます
- 製品バージョン、プロファイルバージョン、入力ハッシュ、出力パス、経過時間、警告数を記録します
- パスワード、証明書、一時ファイル、顧客データは明確な保持ルールの下で管理します
- 顧客ファイルが新しい境界ケースを示したら、回帰用ドキュメントを追加します
製品ドキュメント
追加のコード例
// Ship a known font instead of relying on installed system fonts
Pdf.RegisterUnicodeTTF('C:\Fonts\NotoSansArabic.ttf');
Pdf.CurrentPage.SetFont('NotoSansArabic', [], 12);
// Audit coverage for the codepoints your data actually uses
GID := Pdf.GetUnicodeGlyphForCodepoint($0628); // U+0628 ARABIC LETTER BEH
LogGlyphAudit($0628, GID);// Declare right-to-left reading order at the document level
Pdf.Direction := RightToLeft; // adds vpDirection to ViewerPreferences