Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed May 29, 2022
2 parents 47dda6b + 3d57472 commit e5829f7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 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.0.1 beta 11</h1>
<h1 align="center">8.0.2</h1>

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

Expand Down
2 changes: 1 addition & 1 deletion objects/obj_test_get_glyph_data/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (mouse_check_button(mb_left)) limit_x = mouse_x;
draw_line(limit_x, 0, limit_x, room_height);

var _text = "[scale,2]Hi world[/page]oijwagow\n\ngawoijgawj egonawegh";
var _element = scribble(_text).wrap(limit_x+10);
var _element = scribble(_text).wrap(limit_x-10);

if (keyboard_check_pressed(vk_up )) _element.page(_element.get_page()-1);
if (keyboard_check_pressed(vk_down)) _element.page(_element.get_page()+1);
Expand Down
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 @@ -215,15 +215,9 @@ function __scribble_gen_6_build_lines()
}
else if (SCRIBBLE_FLEXIBLE_WHITESPACE_WIDTH && (_word_grid[# _i, __SCRIBBLE_GEN_WORD.__BIDI_RAW] == __SCRIBBLE_BIDI.WHITESPACE))
{
//If the word at the end of the line is whitespace, trim the whitespace down to fit on the line
//This helps the glyph position getter return more visually pleasing results by ensuring the RHS of the glypg doesn't exceed the wrapping width

var _remaining_space = _simulated_model_max_width - _word_x;
_word_grid[# _i, __SCRIBBLE_GEN_WORD.__WIDTH] = _remaining_space;
_glyph_grid[# _word_start_glyph, __SCRIBBLE_GEN_GLYPH.__WIDTH ] = _remaining_space;
_glyph_grid[# _word_start_glyph, __SCRIBBLE_GEN_GLYPH.__SEPARATION] = _remaining_space;

_word_x += _remaining_space;
//If the word at the end of the line is whitespace, include that on this line
//We trim the whitespace down to fit on the line later
_word_x += _word_width;

var _line_word_end = _i;
__SCRIBBLE_GEN_LINE_END;
Expand Down Expand Up @@ -322,11 +316,40 @@ function __scribble_gen_6_build_lines()
}
}

//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 glypg doesn't exceed the wrapping width
if (SCRIBBLE_FLEXIBLE_WHITESPACE_WIDTH)
{
var _line = 0;
repeat(_line_count)
{
var _line_end_word = _word_grid[# _line, __SCRIBBLE_GEN_WORD.__GLYPH_END];
if (_word_grid[# _line_end_word, __SCRIBBLE_GEN_WORD.__BIDI_RAW] == __SCRIBBLE_BIDI.WHITESPACE) //Only adjust whitespace words
{
var _line_width = _line_grid[# _line, __SCRIBBLE_GEN_LINE.__WIDTH];
if (_line_width > _simulated_model_max_width) //Only adjust lines that actually exceed the maximum size
{
var _delta = _simulated_model_max_width - _line_width;

_line_grid[# _line, __SCRIBBLE_GEN_LINE.__WIDTH] = _simulated_model_max_width;

_word_grid[# _line_end_word, __SCRIBBLE_GEN_WORD.__WIDTH] += _delta;

var _word_start_glyph = _word_grid[# _line_end_word, __SCRIBBLE_GEN_WORD.__GLYPH_START];
_glyph_grid[# _word_start_glyph, __SCRIBBLE_GEN_GLYPH.__WIDTH ] += _delta;
_glyph_grid[# _word_start_glyph, __SCRIBBLE_GEN_GLYPH.__SEPARATION] += _delta;
}
}

++_line;
}
}

__width = ds_grid_get_max(_line_grid, 0, __SCRIBBLE_GEN_LINE.__WIDTH, _line_count - 1, __SCRIBBLE_GEN_LINE.__WIDTH);

with(global.__scribble_generator_state)
{
__word_count = _word_count;
__line_count = _line_count;
}
}
}
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.0.1 beta 11"
#macro __SCRIBBLE_DATE "2022-05-22"
#macro __SCRIBBLE_VERSION "8.0.2"
#macro __SCRIBBLE_DATE "2022-05-29"
#macro __SCRIBBLE_DEBUG false
#macro __SCRIBBLE_VERBOSE_GC false
#macro SCRIBBLE_LOAD_FONTS_ON_BOOT true
Expand Down
4 changes: 2 additions & 2 deletions shaders/__shd_scribble_msdf/__shd_scribble_msdf.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main()
if (u_vShadowColour.a > 0.0)
{
vec4 shadowSample = texture2D(gm_BaseTexture, v_vTexcoord - u_vTexel*u_vShadowOffsetAndSoftness.xy/v_fPixelScale);
float shadowDist = MSDFSignedDistance(shadowSample);
float shadowDist = ROUNDED_BORDERS? SDFSignedDistance(shadowSample) : MSDFSignedDistance(shadowSample);
float alphaShadow = MSDFAlphaSoft(shadowDist, v_fPixelScale, PROPORTIONAL_BORDER_SCALE? (v_fPixelScale*u_fBorderThickness) : u_fBorderThickness, u_vShadowOffsetAndSoftness.z);

float preAlpha = gl_FragColor.a;
Expand All @@ -84,4 +84,4 @@ void main()
{
gl_FragColor.a *= v_vColour.a;
}
}
}

0 comments on commit e5829f7

Please sign in to comment.