I was playing around with XPS in C# and used this example as a starting point: https://code.msdn.microsoft.com/windowsdesktop/How-to-Edit-XPS-file-in-WPF-724ef6fb
I modified the example a bit and created a search and replace application for XPS documents.
The output doesn't look very well:
Copy and paste the question marks to an editor works well and gives me the correct characters.
Now I've found out that when characters are not in the source XPS and new characters are in the target XPS, they can not be found in the font (found this explanation here: https://stackoverflow.com/a/28236296/2058139).
The essence of the problem lies in the use of ODTTF fonts in XPS document. The ODTTF is an obfuscated subsetted font based on the fonts used in the original document. This means that you cannot use for the replacement any character that wasn't in the original document.
Any solution for this?