How do I change the color of text under given rectangle?

Q: I would like to change the color of text that is located in certain
regions of a PDF page. I used your sample code to turn text blue
(HighlightPDFText.cs in
Generally the code works well, except when certain characters are
encountered in the text run, they disappear in the output.
Specifically, the code values ?\x2b5? (hyphen) and ?\x2ce? (asterisk)
in the ?ryumin-light-density-identity-h? font.

What is the approach you recommend to:
1) identify problem fonts/character codes in the source (at or prior
to runtime), and
2) once identified, support the font/character in the output?
A: The problem is that in a PDF file a single character/glyph may be
represented using more than one byte. This means that you need to copy
all bytes during character by character copy.

This is illustrated in the in Files section of this
forum ( The relevant
lines are 119 - 126.