HotPDF, harici bir PDF runtime kurmadan doğrudan PDF oluşturma ve düzenleme, formlar, notlar, şifreleme, dijital imzalar, Unicode yazı tipleri, standart odaklı çıktı ve preflight raporları gereken Delphi ve C++Builder uygulamaları için yerel bir VCL PDF kütüphanesidir.
Bu yazı developers producing multilingual invoices, certificates, labels, or reports from Delphi için hazırlanmıştır. Unicode text shaping for complex scripts konusunu tek bir bileşen çağrısı olarak değil, üretim düzeyinde belge mühendisliği olarak ele alır.
Pratik risk şudur: text can appear plausible in a sample PDF while ligatures, bidirectional order, fallback fonts, or copy-and-search behavior fail for real customer names. Bu nedenle akışın yazılı sözleşmeye, gözlemlenebilir tanılara ve gerçekçi regresyon dosyalarına ihtiyacı vardır.
Mimari kararlar
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
Uygulama akışı
Resolve fonts and shaping before pagination. Aşağıdaki sıra, iş akışını Delphi ve C++Builder ekipleri için incelenebilir tutar.
- 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
Doğrulama kanıtı
Proof that text is readable and extractable. Bu alanları çıktı veya destek kaydıyla birlikte saklayın.
- 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
Mühendislik inceleme notları: Unicode text shaping for complex scripts
Özelliğin bir demoyu aşıp sürüm, destek ve müşteri eskalasyonu sırasında savunulabilir olduğunu doğrulamak için bu inceleme notlarını kullanın.
- Karar: font fallback order for Arabic, Hebrew, Indic, CJK, and mixed Latin text. Uygulama baskı noktası: select fonts that contain the required glyphs before measuring layout. Kabul kanıtı: extracted Unicode text compared with the original application value. Regresyon tetikleyicisi: search may fail when ToUnicode data is missing even if the page renders correctly
- Karar: normalization rules for copied text, database values, and template placeholders. Uygulama baskı noktası: shape and position text before page breaks are finalized. Kabul kanıtı: viewer screenshots for representative right-to-left and combining-mark cases. Regresyon tetikleyicisi: database collation can alter composed characters before the PDF layer sees them
- Karar: right-to-left paragraph handling and mixed-direction number policy. Uygulama baskı noktası: embed or subset fonts according to licensing and PDF standard requirements. Kabul kanıtı: font selected for every script range and fallback reason when it changed. Regresyon tetikleyicisi: font substitution on a developer machine can hide missing embedded fonts
- Karar: whether text must remain searchable, selectable, and accessible after output. Uygulama baskı noktası: verify visual output and extracted text with multilingual regression samples. Kabul kanıtı: glyph coverage warnings, embedding mode, and subset identifier. Regresyon tetikleyicisi: line breaks in bidirectional text can reorder punctuation and numbers
Sınır durumları
- 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 notes
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. Important terms include Unicode, text shaping, font embedding, ToUnicode, bidirectional text, fallback font.
Delphi kod örneği
Aşağıdaki Delphi taslağı bu konu için pratik bir servis sınırını gösterir. Politika kontrollerini, günlüklemeyi ve doğrulamayı dar ürün çağrısı bölümünün dışında tutarak akışı test edilebilir bırakın.
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;
Üretim kontrol listesi
- İş akışını boş bir dosyada, normal bir müşteri dosyasında ve en kötü durum dosyasında çalıştırın
- Oluşturulan PDF'yi hedef görüntüleyici, doğrulayıcı, yazıcı veya aşağı akış uygulamasıyla açın
- Ürün sürümünü, profil sürümünü, giriş karmasını, çıktı yolunu, geçen süreyi ve uyarı sayısını kaydedin
- Parolaları, sertifikaları, geçici dosyaları ve müşteri verilerini açık saklama kuralları altında tutun
- Bir müşteri dosyası yeni bir uç durum ortaya çıkardığında regresyon belgeleri ekleyin
Ürün belgeleri
Ek kod örnekleri
// 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