Changing Font in RTF Tag OBX-5

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Changing Font in RTF Tag OBX-5

  • Creator
    Topic
  • #55756
    Mohammed Iqbal
    Participant

      Hello everyone,

      I was hoping to receive some help with creating a simple TCL for replacing the font specified in the RTF text encoded within an OBX-5 field.

      Currently, the font is tagged as follows: {Efonttbl{Ef0EfnilEfcharset0 Microsoft Sans Serif;}

      And I need it to be converted to: {Efonttbl{Ef0EfnilEfcharset0 Courier New;}

      However, when I attempt to do so witha simple TCL fragment within my xlate I am observing escaping occurring at every space causing for my string map to not identify the string “Microsoft Sans Serif” so it may be mapped to “Courier New”?

      I may be approaching this wrong; however, if I could please receive some suggestions it would be greatly appreciated.

      Thank you.

      Respectfully,

      Mohammed[/i]

    Viewing 1 reply thread
    • Author
      Replies
      • #86409
        bill bearden
        Participant

          Hello Mohammed,

          The good thing about RTF is that at least it is printable characters. The bad thing about RTF is oh my gosh have you ever looked at RTF? 🙂 It isn’t very Tcl-friendly with all the backslashes and braces.

          I have a couple of Tcl scripts that modify RTF in Cloverleaf. I use regsub. For example something like…

          Code:

          set Source {Efonttbl{Ef0EfnilEfcharset0 Microsoft Sans Serif;}}
          set Success [regsub -all — {fcharset0 Microsoft Sans Serif} $Source {fcharset0 Courier New} Target]
          if {$Success} {
             echo $Target
          }

          Good luck,

          Bill

        • #86410
          Robert Kersemakers
          Participant

            Once had an Xlate where the bookmarks inside the rtf had to be removed because the target system couldn’t display the rtf if it had bookmarks.

            Here are the lines in that Xlate:

            Code:

            # Remove all Bookmark ‘{*bkmk….}’ statements from RTF text
            regsub -all {{\*\bkmk([^}])*}} $content {} content

            Hope this helps if you want to specifically substitute the fonts.

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.