G
gameon
Guest
I created my own fonts using different sizes within a for loop and the font_add function. The idea was to have the font sizes equal the name then you could use a font by the size or use "+" or "-" to move up or down (respectively) in size. The code looks like this:
Create:
In Keypress(Any) Script:
When I use the "-" key it will get smaller but then will skip to the last size sometimes. While the "+" key doesn't seem to work at all. Any advice on how to approach this better?
EDIT: break statements are in my original code just didnt copy over, so I added them.
Create:
Code:
// Create our font size range 8-48.
minsize = 8;
maxsize = 48;
// Create our font with inconsolta. Sizes and names are the same 8-48.
var myfont = working_directory + "Inconsolata.otf"
for(i = minsize; i < maxsize; i++)
{
font_add(myfont, i, false, false, 32, 127)
}
// The variable "font" sets our font size. We will start at 12
font = 12;
Code:
key = keyboard_key;
if (line < 100 && !keyboard_check (vk_control))
{
if (string_count(chr(key), keys) == 1 || key > 127)
{
blink = true; alarm[0] = blink_speed;
cursx += wid; pos++;
txt[line] = string_insert(keyboard_lastchar, txt[line], pos)
}
}
if (key != vk_control && keyboard_key != vk_alt){
switch(key){
case vk_add:
font++;
if (font > maxsize) {font = minsize;}
break;
case vk_subtract:
font--;
if (font < minsize) {font = maxsize}
break;
}}
EDIT: break statements are in my original code just didnt copy over, so I added them.
Last edited by a moderator: