Editing Thai scans: why vowels and tone marks shift
Short answer: Thai vowels and tone marks do not take their own space; they stack above or below the consonant, at positions set by the font's shaping rules. Software that places characters one by one puts them in the wrong place. EnjoyPDF shapes the text with HarfBuzz according to the font rules first, then writes the result to the page.
Why the marks shift
One Thai syllable can stack several layers: a consonant, an upper or lower vowel, and a tone mark, as in ที่, นั้น and กู้. In Unicode these marks are separate characters, but when displayed they must be placed above or below the consonant according to positioning rules in the font, and they must move aside for tall consonants.
Software that can only place characters one at a time puts the marks in fixed positions, which leads to:
- Tone marks overlapping upper vowels;
- Marks drifting over the neighboring character;
- Lower vowels colliding with the next line;
- Copied text coming out in the wrong order.
When Thai users talk about “สระลอย” (floating vowels) or “วรรณยุกต์เพี้ยน” (misplaced tone marks), these are the problems they mean.
How PDF Text Replacer handles it
- Recognition: Thai scans are recognized with the PP-OCRv5 Thai model. When the keyword is Thai, “Auto” selects this model.
- Shaping: the new text is passed to HarfBuzz, which calculates the position of each mark from the OpenType rules of the selected font.
- Writing: the shaped result is written as vector outlines, with a layer of invisible correct text at the same position, so it displays correctly and can be searched and copied.
- Read-back: on save, the text is recognized again and checked. Thai digits are treated as equivalent to Arabic digits.
Recommendations
- Scan at 300 DPI, especially for old prints;
- Before replacing, switch to “Preview replacement” and zoom in to check mark positions;
- Do not mix Chinese and Thai in one replacement unless a font with both scripts is installed.
FAQ
Which Thai font is used by default?
With "Replacement font: Auto", Thai uses Tahoma. You can also choose another installed Thai font from the font menu.
How accurate is recognition on Thai scans?
On recently printed documents it is usable but needs review. Old prints and low-resolution scans are still experimental. Measured character error rates are in the language support matrix.
What happens if I edit the replaced Thai text again in another PDF editor?
In the text layer, the Thai text is shown as vector outlines plus invisible text. Another editor sees the outlines, not editable text.
Sources
- ThaiDocs: แก้ไขตัวอักษรจาก PDF เพี้ยน (fixing garbled Thai characters in PDFs) · Checked on 2026-10-14