Author Topic: Easy way of forcing Uppercase text  (Read 3390 times)

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Easy way of forcing Uppercase text
« on: February 04, 2019, 01:06:17 PM »
I found an easy way to utilize uppercase characters for things like [Title], [Overview] etc. Right now the goto methods are:


  • Use a font which is all uppercase. Its the easiest way but if you want to keep uniformity in theme you have to go all capitals, else need to use more then one font which is not desirable in most cases.
  • Save the said text in Uppercase e.g. use Excel to change all titles to Capitals. This also works but you will be stuck with a single theme, moving would mean redoing it all again.
  • Use a function and use .toupper() with text, A great way to do things (you retain single font) but utilizing things like [Title] in shuffle, after the function can become complicated.

I found another way to do the needful, there is an app "fontforge" for creating and editing fonts. Make a copy of font you are using in theme (e.g. Ariel Medium), open the copy in fontforge. Now select and delete the small letters (a -z), copy capital letters (A - Z) and paste them in place of small letters. Go to generate font and save the file naming it something like Ariel Medium Uppercase (save as true type i.e. TTF) . Use this font in places where you want text in all capitals and place it in /layout dir. Couple of things:

  • Most fonts are copyright so only share the modified versions where you are sure font is open source/ or licensed such as to allow modified sharing.
  • Portable version of fontforge is available plus its available on all platforms (Win, *Nix, Mac)
  • Fontforge may show errors when generating font, try saving the font without any modifications if the same errors are reported then can be ignored.

Links:
Github: https://fontforge.github.io/en-US/
Sourceforge: https://sourceforge.net/projects/fontforge/

Select & Clear lowercase:


Select & Paste Uppercase in-place of lowercase:


Original Source (ctrlcctrlv 's post): https://github.com/fontforge/fontforge/issues/2418

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Easy way of forcing Uppercase text
« Reply #1 on: February 04, 2019, 01:53:46 PM »
Magic function and then return toupper(string); Not hard.

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Easy way of forcing Uppercase text
« Reply #2 on: February 04, 2019, 03:15:58 PM »
I wrote a function to "re-sanitize" titles when using magic tokens:

Code: [Select]
function getTitle (ioffset = 0) {
    // Working from the raw title, we have to cut away any extra junk:
    local _t = fe.game_info( Info.Title, ioffset );
   
    // Ignore anything after the first (, [, or /:
    local _i = null;
    _i = _t.find( "(" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "[" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "/" );
    _t = _i ? _t.slice( 0, _i ) : _t;
 
    return strip(_t).toupper();
}

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Easy way of forcing Uppercase text
« Reply #3 on: February 04, 2019, 04:32:08 PM »
I wrote a function to "re-sanitize" titles when using magic tokens:

Code: [Select]
function getTitle (ioffset = 0) {
    // Working from the raw title, we have to cut away any extra junk:
    local _t = fe.game_info( Info.Title, ioffset );
   
    // Ignore anything after the first (, [, or /:
    local _i = null;
    _i = _t.find( "(" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "[" );
    _t = _i ? _t.slice( 0, _i ) : _t;

    _i = _t.find( "/" );
    _t = _i ? _t.slice( 0, _i ) : _t;
 
    return strip(_t).toupper();
}

split(string, "(/[");

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Easy way of forcing Uppercase text
« Reply #4 on: February 05, 2019, 04:19:20 AM »
split(string, "(/[");

Yeah, that's much better! Now I have some updates to make...