Skip to content

Commit

Permalink
Merge pull request #379 from mgeisler/disable-wrap-algo-select
Browse files Browse the repository at this point in the history
Disable the `WrapAlgorithm` select field for now
  • Loading branch information
mgeisler authored Jun 5, 2021
2 parents a475095 + f81941c commit 85d2c1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 3 additions & 5 deletions examples/wasm/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ <h1>Textwrap WebAssembly Demo</h1>
</select>
</div>

<!-- See https://github.com/mgeisler/textwrap/issues/326
<div class="option">
<label for="wrap-algorithm">Wrap algorithm:</label>
<select id="wrap-algorithm">
<!--
The optimal-fit algorithm does not work well for proportional
fonts, see https://github.com/mgeisler/textwrap/issues/326.
<option value="OptimalFit">Optimal-fit</option>
-->
<option value="OptimalFit">Optimal-fit</option>
<option value="FirstFit">First-fit</option>
</select>
</div>
-->
</div>

<div>
Expand Down
5 changes: 4 additions & 1 deletion examples/wasm/www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ function redraw(event) {
let breakWords = document.getElementById("break-words").checked;
let wordSeparator = document.getElementById("word-separator").value;
let wordSplitter = document.getElementById("word-splitter").value;
let wrapAlgorithm = document.getElementById("wrap-algorithm").value;
// TODO: The optimal-fit algorithm does not work well for
// proportional fonts, so we always use FirstFit. See
// https://github.com/mgeisler/textwrap/issues/326.
let wrapAlgorithm = "FirstFit"; // document.getElementById("wrap-algorithm").value;
let options = new WasmOptions(lineWidth, breakWords, wordSeparator, wordSplitter, wrapAlgorithm);
draw_wrapped_text(ctx, options, text);
}
Expand Down

0 comments on commit 85d2c1c

Please sign in to comment.