Skip to content

Commit

Permalink
Merge branch 'dev-lts'
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Mar 13, 2023
2 parents c7baa74 + b9519b8 commit 2355d39
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center"><img src="https://raw.githubusercontent.com/JujuAdams/scribble/master/LOGO.png" style="display:block; margin:auto; width:300px"></p>
<h1 align="center">Scribble 8.6.2</h1>
<h1 align="center">Scribble 8.7.0</h1>

<p align="center">A modern text renderer for GameMaker Studio 2022 LTS by <b>@jujuadams</b></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ if (!SCRIBBLE_ALLOW_GLYPH_DATA_GETTER) __scribble_error("SCRIBBLE_ALLOW_GLYPH_DA

typist = scribble_typist();
typist.in(0.1, 3);
typist.character_delay_add(". ", 1000);
typist.character_delay_add(".", 1000);

test_string = "Abc. Abcdefghijklmnop. Qrstuvwxyz... Abc.Def.Ghi.Jkl.Mno.";
2 changes: 1 addition & 1 deletion options/windows/options_windows.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ function __scribble_class_element(_string, _unique_id) constructor
__text = _text;
__unique_id = _unique_id;

var _new_cache_name = __text + ":" + __unique_id;
var _new_cache_name = __text + ((_unique_id == undefined)? SCRIBBLE_DEFAULT_UNIQUE_ID : (":" + string(_unique_id)));
if (__cache_name != _new_cache_name)
{
flush();
Expand Down
12 changes: 9 additions & 3 deletions scripts/__scribble_class_typist/__scribble_class_typist.gml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function __scribble_class_typist(_per_line) constructor
__sound_overlap = 0;
__sound_pitch_min = 1;
__sound_pitch_max = 1;
__sound_gain = 1;
__sound_per_char = false;
__sound_finish_time = current_time;
__sound_per_char_exception = false;
Expand Down Expand Up @@ -139,7 +140,8 @@ function __scribble_class_typist(_per_line) constructor
/// @param overlap
/// @param pitchMin
/// @param pitchMax
static sound = function(_in_sound_array, _overlap, _pitch_min, _pitch_max)
/// @param [gain=1]
static sound = function(_in_sound_array, _overlap, _pitch_min, _pitch_max, _gain = 1)
{
var _sound_array = _in_sound_array;
if (!is_array(_sound_array)) _sound_array = [_sound_array];
Expand All @@ -148,6 +150,7 @@ function __scribble_class_typist(_per_line) constructor
__sound_overlap = _overlap;
__sound_pitch_min = _pitch_min;
__sound_pitch_max = _pitch_max;
__sound_gain = _gain;
__sound_per_char = false;

return self;
Expand All @@ -157,14 +160,16 @@ function __scribble_class_typist(_per_line) constructor
/// @param pitchMin
/// @param pitchMax
/// @param [exceptionString]
static sound_per_char = function(_in_sound_array, _pitch_min, _pitch_max, _exception_string)
/// @param [gain=1]
static sound_per_char = function(_in_sound_array, _pitch_min, _pitch_max, _exception_string, _gain = 1)
{
var _sound_array = _in_sound_array;
if (!is_array(_sound_array)) _sound_array = [_sound_array];

__sound_array = _sound_array;
__sound_pitch_min = _pitch_min;
__sound_pitch_max = _pitch_max;
__sound_gain = _gain;
__sound_per_char = true;

if (is_string(_exception_string))
Expand Down Expand Up @@ -602,6 +607,7 @@ function __scribble_class_typist(_per_line) constructor
{
var _inst = audio_play_sound(_audio_asset, 0, false);
audio_sound_pitch(_inst, lerp(__sound_pitch_min, __sound_pitch_max, __scribble_random()));
audio_sound_gain(_inst, __sound_gain, 0);
__sound_finish_time = current_time + 1000*audio_sound_length(_inst) - __sound_overlap;
}
}
Expand Down Expand Up @@ -775,7 +781,7 @@ function __scribble_class_typist(_per_line) constructor
&& !__ignore_delay
&& __character_delay
&& (__last_character >= 1) //Don't check character delay until we're on the first character (index=1)
&& ((__last_character < _page_character_count-1) || (_found_size > 0)))
&& ((__last_character < (SCRIBBLE_DELAY_LAST_CHARACTER? _page_character_count : (_page_character_count-1))) || (_found_size > 0)))
{
var _glyph_ord = _page_data.__glyph_grid[# __last_character-1, __SCRIBBLE_GLYPH_LAYOUT.__UNICODE];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#macro SCRIBBLE_AUTOFIT_INLINE_SURFACES false //Whether to automatically scale surfaces to fit into the line of text. This is based on the font height of the current font
#macro SCRIBBLE_USE_KERNING true
#macro SCRIBBLE_SPRITE_BILINEAR_FILTERING undefined
#macro SCRIBBLE_DELAY_LAST_CHARACTER false



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
_line_grid[# _line_count, __SCRIBBLE_GEN_LINE.__WORD_START ] = _line_word_start;\
_line_grid[# _line_count, __SCRIBBLE_GEN_LINE.__HALIGN ] = _state_halign;\
_line_grid[# _line_count, __SCRIBBLE_GEN_LINE.__STARTS_MANUAL_PAGE] = false;\
;\ //Align the left-hand side of the word to the left-hand side of the line. This corrects visually unpleasant gaps and overlaps
;\ //Adjust the first word's width to account for visual tweaks
;\ //TODO - Implement for R2L text
if (_word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__BIDI] < __SCRIBBLE_BIDI.R2L)\
if ((SCRIBBLE_NEWLINES_PAD_LEFT_SPACE || SCRIBBLE_NEWLINES_TRIM_LEFT_SPACE) && (_word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__BIDI] < __SCRIBBLE_BIDI.R2L))\
{\
_word_glyph_start = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_START];\
_word_glyph_end = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_END ];\
var _left_correction = _glyph_grid[# _word_glyph_start, __SCRIBBLE_GEN_GLYPH.__LEFT_OFFSET];\
var _word_glyph_start = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_START ];\
var _word_glyph_end = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_END ];\
var _left_correction = _glyph_grid[# _word_glyph_start, __SCRIBBLE_GEN_GLYPH.__LEFT_OFFSET];\
;\
if (((_left_correction > 0) && SCRIBBLE_NEWLINES_PAD_LEFT_SPACE) || ((_left_correction < 0) && SCRIBBLE_NEWLINES_TRIM_LEFT_SPACE))\
{\
ds_grid_add_region(_glyph_grid, _word_glyph_start, __SCRIBBLE_GEN_GLYPH.__X, _word_glyph_end, __SCRIBBLE_GEN_GLYPH.__X, _left_correction);\
_word_width += _left_correction;\
_word_grid[# _i, __SCRIBBLE_GEN_WORD.__WIDTH] += _left_correction;\
}\
}\
_word_x = _indent_x;
Expand Down Expand Up @@ -347,6 +345,31 @@ function __scribble_gen_6_build_lines()
}
}

//Align the left-hand side of the word to the left-hand side of the line. This corrects visually unpleasant gaps and overlaps
//TODO - Implement for R2L text
if (SCRIBBLE_NEWLINES_PAD_LEFT_SPACE || SCRIBBLE_NEWLINES_TRIM_LEFT_SPACE)
{
var _line = 0;
repeat(_line_count)
{
var _line_word_start = _line_grid[# _line, __SCRIBBLE_GEN_LINE.__WORD_START];
if (_word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__BIDI] < __SCRIBBLE_BIDI.R2L)
{
var _word_glyph_start = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_START ];
var _word_glyph_end = _word_grid[# _line_word_start, __SCRIBBLE_GEN_WORD.__GLYPH_END ];
var _left_correction = _glyph_grid[# _word_glyph_start, __SCRIBBLE_GEN_GLYPH.__LEFT_OFFSET];

if (((_left_correction > 0) && SCRIBBLE_NEWLINES_PAD_LEFT_SPACE) || ((_left_correction < 0) && SCRIBBLE_NEWLINES_TRIM_LEFT_SPACE))
{
ds_grid_add_region(_glyph_grid, _word_glyph_start, __SCRIBBLE_GEN_GLYPH.__X, _word_glyph_end, __SCRIBBLE_GEN_GLYPH.__X, _left_correction);
_word_grid[# _i, __SCRIBBLE_GEN_WORD.__WIDTH] += _left_correction;
}
}

++_line;
}
}

//Trim the whitespace at the end of lines to fit into the desired width
//This helps the glyph position getter return more visually pleasing results by ensuring the RHS of the glyph doesn't exceed the wrapping width
if (SCRIBBLE_FLEXIBLE_WHITESPACE_WIDTH && _wrap_apply)
Expand Down
4 changes: 2 additions & 2 deletions scripts/__scribble_system/__scribble_system.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @jujuadams
#macro __SCRIBBLE_VERSION "8.6.2"
#macro __SCRIBBLE_DATE "2023-03-09"
#macro __SCRIBBLE_VERSION "8.7.0"
#macro __SCRIBBLE_DATE "2023-03-13"
#macro __SCRIBBLE_DEBUG false
#macro __SCRIBBLE_VERBOSE_GC false
#macro SCRIBBLE_LOAD_FONTS_ON_BOOT true
Expand Down

0 comments on commit 2355d39

Please sign in to comment.