Texter

  • byzod
    27th Jan 2013 Member 8 Permalink

    The old post is abandoned, the old id is abandoned too.

    Modified from the Lua text drawing of @mniip

    If you find any bug or have some idea, just post.

     

    Download

    Script:http://pastebin.com/RUxxwBmn

    Default Fonts(5px and 7px):http://pastebin.com/i3jD109r

    Package(Script & all font here): http://www.mediafire.com/?unsnxi89aw9t9j9

     Fonts generated by TFGen:

    Tesla Font by FeynmanTechnologies

    Times New Roman by FeynmanTechnologies

    Lucida Calligraphy by FeynmanTechnologies

    Calligraphy 13px and Calligraphy 25px by FeynmanTechnologies

     

    Note: You need to put the font at the same or deeper folder of script.For example:

    ".\scripts\texter.lua"           and   ".\scripts\texter fonts\5px&7px.texterfont"   is good

    ".\scripts\mains\texter.lua"  and   ".\scripts\5px&7px.texterfont"   is bad.

     Latest Version: Unspeakable Crawling Skully

     

    Rocket Jump Usage:

    After installed the script, enter TPT and press Ctrl + T.

     


     

    Noraml Usage:

    Ctrl+T then input text (str) and element type, letter spacing (ptype, hspc, vspc) and choose the font

      Easiest way to draw text! The text will be drawn under your mouse pointer.

      Example: Press Ctrl+T then type "hello TPT" in the bottom text box and hit enter then it will show up under your mouse. Type "hello TPT" in, and "BIZR, 13, 20" in the params box enter will draw two line of text with BIZR, the character  spacing is 13px (default is 1), the line spacing is 20px (default is 3). From Unspeakable Crawling Sticky Tentacle, Texter will read your left selected element.

     

    T(string str, string ptype, number hspc, number vspc, string fontName)

      Similar to the GUI version.

      Example: T('Grrrr', 'DUST', 14, 5, "7px") or T('Grrrr')(using DUST).

     

    My 7px font

    7px font

     

    These above are all you need at the first time using Texter, keep reading if you want to know more.

     


     

    New feature for user:

    *New powerful GUI

    *Extremely easy usage

    *Customizable character spacing, font and render mode

    *Fully keyboard symbols support (added [`],[~],[$]and["])

     

    New feature for developer:

    *Automatic character size detect

    *Automatic font file search

    *Multi-font files load

    *Vertical and horizontal offset for character support (horizontal offset not used currently)

     

    Advanced Usage:

    Texter.LoadFont(string fontName, string rootPath, string optionalSuffix, string optionalPrefix, number depth)

       Load the working font file, with optional file name prefix and suffix, and recursion depth  

    Texter.Tchar(char char, number x, number y, string ptype, string fontName)
    Texter.Tstr(string str, number x, number y, string ptype, number hspacing, number vspacing, string fontName)

     

    Additional Note:

       When using the T() function, you need to escape magic characters (e.g. ()\*?) while escaping is no needed for GUI version.

       Theoretically the GUI version do not support escaped characters at all, but I did some trick to support \n. Unfortunately, like what you see in the prompt box, "\\n" can never be displayed due to the trick, if you feel inconvenient about this, please tell me.

     

    Demo:

    Demo

     

     

    Changelog:

    Unspeakable Crawling Skully Feb.17 2013

    + dcolor bug was fixed since 86.0, you can use it now (mode 2 or 3) but it's rather slow. I guess I can optimize it but too lazy to implement it.

     

    Unspeakable Crawling Skull Jan.29 2013

    + Now you can use element type 0 to draw text with NONE, which will delete existed particles.

    + Font mode support: now you can draw your text with selected element type or the type stored in font file. Decoration color is also supported.

    + Texter can recognize font generated by TFGen 0.3.0 or lower.

    * Some bug fix.

     

    Unspeakable Crawling Rachis Jan.27 2013

    + New GUI and font structure

    + Multi-font file support

    + Font Generator support

    + Can choose the font used to create text with the new GUI

    * Few bugs fix

    - Since I made font generator, it's no need to keep the font data as matrix, just too lazy to change it

     

    Unspeakable Crawling Sticky Tentacle Jan.20 2013

    + GUI and command line mode can now use the element you left selected as default, thanks to the 85.0 update

    * Minor bug which fails to detect null argument

     

    Unspeakable Crawling Tentacle Dec.19 2012

    * Structure improvement

    * Some tweak for 5px font

    + New 7px font

    + Hot key and GUI

    + Automatic font search

    + Character and line spacing

     

    Unspeakable Crawling Evil Jun.29 2012

    * Totally different design, improved script structure

    * Support for more possible properties (by using table to store font matrix)

    * Separate font file

     

    Unspeakable Crawling Chaos Jun.29 2012

    * Mod from mniip's Lua text drawing

    * Code clean up

    * Easy usage (Simple syntax)

    + Fully keyboard symbols support (added [`],[~],[$]and["])

    + Automatic character size detect

    + Vertical and horizontal offset for character support

     


     

    Font file format

    Now the main and font is separated, you may edit them separately too.Font file structure:
    Texter._Fontmatrix={--root
      ["5px"] = { --font name(identifier)
        Height=7, --font information(s)
        ["a"] = { --the character itself, take 'a' as an example
          Mtx = { --mtx means matrix, the pixel shape matrix
            {0,1,0},
            {1,0,1},
            {1,1,1},
            {1,0,1},
            {1,0,1}
          },
          Margin={
            Top   = 1,--vertical offset, same direction with y axis
            Left  =-2,--horizontal offset, same direction with x axis
            Right = 3
          }
          ... --any other property to add
        },
        ["b"] = { --other characters
          ...
        }
        ...
      },
      ["7px"] = { --other fonts
          ...
      }
    }

  • FeynmanTechnologies
    1st Feb 2013 Banned 0 Permalink
    This post is hidden because the user is banned
  • byzod
    2nd Feb 2013 Member 1 Permalink

    @FeynmanTechnologies (View Post)

     It‘s me should thank you for alk those awesome font! You must spent a lot of time on those, I just digitalize them, all the credits goes to the font maker

  • boxmein
    2nd Feb 2013 Moderator 1 Permalink
    I'm sorry to crush your views on Feynman but his last font, Calibri, was completely CGI. We're not sure the rest are.
  • byzod
    2nd Feb 2013 Member 0 Permalink

    @boxmein (View Post)

     Well, so font maker is not font designer :)

  • FeynmanTechnologies
    2nd Feb 2013 Banned 0 Permalink
    This post is hidden because the user is banned
  • flashgamer001
    27th Feb 2013 Member 1 Permalink

    I'm going insane. Does 86.1 break everything? Fonts aren't detected at same OR lower levels ("No font available"), and trying to continue anyway throws this:

    scripts/Texter.lua:281: attempt to index field '?' (a nil value)

    (line 281 is:

        letter = Texter._Fontmatrix[fontName][char]

    under comment --get character data .)

    Any ideas?

  • jacob1
    31st Jan 2015 Developer 1 Permalink
    Someone tried submitting this to the script server, so I approved it with small modifications:
    http://starcatcher.us/scripts/#51 for actual script
    http://starcatcher.us/scripts/#52 for default font

    I changed it to make the font searching work on Linux / mac, and also made it possible to load fonts as scripts instead of only on initial startup. Fonts can be loaded before or after the texter script itself.
    Also on my mod, ctrl+t will print a help text message for Texter.Tstr


    But anyway, really useful script! I use it for all my text-only saves :P
  • CeeJayBee
    1st Feb 2015 Member 1 Permalink
    omg jacob1 necroed
    </offtopic>
    Anyway, nice script.
  • RCAProduction
    14th May 2017 Member 1 Permalink

    It appears to be broken. Whenever I run the script, it returns 

     

    cannot open .\5px&7px.texterfont: No such file or directory

     

    I have an old version on my computer which seems to run OK.

     

    Edited once by RCAProduction. Last: 14th May 2017