Russian characters in RTF-Preview but not in PDF-Export

  • Hello,

    I can successfully insert russian characters into an RTF-file by using RTF.InputStringW("mytext"). The RTF-Preview shows it correctly, but when creating the PDF-file out of it (via wPDF) the russian characters have all gone (empty output).
    I use the current version of wPDF and WPTools5 and Acrobat 7 for viewing.

    I tried to initialize the wPDF-class with this:

    Code
    WPPDFExport.Canvas.Font.Name := 'Arial';WPPDFExport.Canvas.Font.Charset := RUSSIAN_CHARSET;WPPDFExport.FontMode:= wpEmbedSubsetTrueType_Charsets;WPPDFExport.Source := RTF;

    I've also tried to set the charset explicitly before inserting the text:

    Code
    RTF.CPAttr.CharSet:= russian_charset;
    RTF.InputStringW(s);

    Is something missing?

  • Hello Julian,

    Thanks, now I use WritingAttr.SetFontCharset as you suggested.

    Code
    [...]
    RTF.CPPosition := FoundPosition;
    RTF.WritingAttr.SetFontCharset(RUSSIAN_CHARSET);
    RTF.InputStringW(UTF8D(Output));
    [...]

    There is still a problem: The code above is used in a loop which replaces tags within an RTF-document. (e.g. <lastname> ist replaced by Smith). The tags may be organized in tables. The SetFontCharset command seems only to work in the first row and first column of a table, but not in the other columns and rows!
    In my code, I only jump to the position of the tag by using RTF.CPPosition:= FoundPosition. Is there anything else I have to do?

    • Offizieller Beitrag

    Hi,

    >> WritingAttr.SetFontCharset command seems only to work in the first row and first column of a table

    I see no reason for this to be the case. WritingAttr is used to create the CharAttr index for new text.

    You can of course use that once, the store WritingAttr.CharAttr to a cardinal and use this cardinal as CharAttr to insert text, Paragraph.Insert(.., index) for example.

    Julian