/usr/share/doc/renpy/html/text.html is in renpy-doc 6.17.6-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Text — Ren'Py Documentation</title>
<link rel="stylesheet" href="_static/screen.css" type="text/css" media="screen, projection"/>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="screen, projection"/>
<![endif]-->
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '6.18.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ren'Py Documentation" href="index.html" />
<link rel="next" title="Translation" href="translation.html" />
<link rel="prev" title="Voice" href="voice.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="translation.html" title="Translation"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="voice.html" title="Voice"
accesskey="P">previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<div class="container">
<div class="span4">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Text</a><ul>
<li><a class="reference internal" href="#escape-characters">Escape Characters</a></li>
<li><a class="reference internal" href="#interpolating-data">Interpolating Data</a></li>
<li><a class="reference internal" href="#styling-and-text-tags">Styling and Text Tags</a><ul>
<li><a class="reference internal" href="#general-text-tags">General Text Tags</a></li>
<li><a class="reference internal" href="#dialogue-text-tags">Dialogue Text Tags</a></li>
<li><a class="reference internal" href="#user-defined-text-tags">User-Defined Text Tags</a></li>
</ul>
</li>
<li><a class="reference internal" href="#non-english-languages">Non-English Languages</a><ul>
<li><a class="reference internal" href="#vertical-text">Vertical Text</a></li>
</ul>
</li>
<li><a class="reference internal" href="#ruby-text">Ruby Text</a></li>
<li><a class="reference internal" href="#fonts">Fonts</a><ul>
<li><a class="reference internal" href="#font-replacement">Font Replacement</a></li>
<li><a class="reference internal" href="#image-based-fonts">Image-Based Fonts</a></li>
<li><a class="reference internal" href="#font-groups">Font Groups</a></li>
</ul>
</li>
<li><a class="reference internal" href="#text-displayable">Text Displayable</a></li>
<li><a class="reference internal" href="#slow-text-concerns">Slow Text Concerns</a><ul>
<li><a class="reference internal" href="#text-overflow-logging">Text Overflow Logging</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="voice.html"
title="previous chapter">Voice</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="translation.html"
title="next chapter">Translation</a></p>
<h4>Search</h4>
<div id="cse-search-form" style="width: 100%;"></div>
<div class="copydata">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
<br>
</div>
</div>
</div>
</div>
<div class="document span20 last">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="text">
<span id="id1"></span><h1>Text<a class="headerlink" href="#text" title="Permalink to this headline">¶</a></h1>
<p>Ren'Py contains several ways of displaying text. The <a class="reference internal" href="dialogue.html#say-statement"><em>say</em></a>
and <a class="reference internal" href="menus.html#menu-statement"><em>menu</em></a> are primarily concerned with the
display of text to the user. The user interface often contains text,
displayed using the <a class="reference internal" href="screens.html#sl-text"><em>text</em></a>, <a class="reference internal" href="screens.html#sl-textbutton"><em>textbutton</em></a>,
and <a class="reference internal" href="screens.html#sl-label"><em>label</em></a> screen language statements. These
functions, along with others, create <a class="reference internal" href="#Text" title="Text"><tt class="xref py py-func docutils literal"><span class="pre">Text()</span></tt></a> displayables, and
show them on the screen.</p>
<p>The Text displayable is responsible for managing the process of
showing the text to the user. The text displayable performs actions in
the following order:</p>
<ol class="arabic simple">
<li>Translating text.</li>
<li>Interpolating data into the text.</li>
<li>Styling the text using styles and text tags.</li>
<li>Laying out the styled text.</li>
<li>Drawing the text to the screen.</li>
</ol>
<p>This chapter discusses the process of text display in Ren'Py.</p>
<div class="section" id="escape-characters">
<h2>Escape Characters<a class="headerlink" href="#escape-characters" title="Permalink to this headline">¶</a></h2>
<p>There are three special characters that can control the way Ren'Py
displays text. A creator needs to be aware of these characters to
ensure that their writing is not accidentally misinterpreted by the engine.</p>
<dl class="docutils">
<dt>(backslash)</dt>
<dd><p class="first">The backslash character is used to introduce when writing a Ren'Py
or Python string. Some common escape codes are:</p>
<dl class="last docutils">
<dt>\" (backslash-doublequote)</dt>
<dd>Includes a doublequote in a double-quoted string.</dd>
<dt>\' (backslash-quote)</dt>
<dd>Includes a single quote in a single-quoted string.</dd>
<dt>\ (backslash-space)</dt>
<dd>Includes an additional space in a Ren'Py string. By default,
Ren'Py script text collapses adjacent whitespace into a single
space character.</dd>
<dt>\n (backslash-n)</dt>
<dd>Includes a newline character in the text.</dd>
<dt>\\ (backslash-backslash)</dt>
<dd>Includes a backslash character in the text.</dd>
</dl>
</dd>
<dt>[ (left bracket)</dt>
<dd>The left bracket is used to introduce interpolation of a value
into the text. To include a single left bracket in your text,
double it - write <tt class="docutils literal"><span class="pre">[[</span></tt>.</dd>
<dt>{ (left brace)</dt>
<dd>The left brace is used to introduce a text tag. To include a left
brace in your text, double it - write <tt class="docutils literal"><span class="pre">{{</span></tt>.</dd>
</dl>
</div>
<div class="section" id="interpolating-data">
<h2>Interpolating Data<a class="headerlink" href="#interpolating-data" title="Permalink to this headline">¶</a></h2>
<p>Ren'Py supports interpolating data into the text string before it is
displayed. For example, if the player's name is stored in the
<tt class="docutils literal"><span class="pre">playername</span></tt> variable, one could write a line of dialogue like:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"Welcome to the Nekomimi Institute, [playername]!"</span>
</pre></div>
</div>
<p>Ren'Py will interpolate variables found in the global store. When
using a text widget in a screen, Ren'Py will also interpolate screen
local variables. (This can be overridden by supplying an explicit
scope argument to the Text displayable.)</p>
<p>Ren'Py isn't limited to interpolating simple variables. It can also
interpolate fields and components of tuples. So it's possible to have
code like:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"My first name is [player.names[0]]."</span>
</pre></div>
</div>
<p>It's possible to apply formatting codes when displaying numbers. This
code will display a floating point number to two decimal places:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">$</span> <span class="n">percent</span> <span class="o">=</span> <span class="mf">100.0</span> <span class="o">*</span> <span class="n">points</span> <span class="o">/</span> <span class="n">max_points</span>
<span class="n">g</span> <span class="s">"I like you [percent:.2] percent!"</span>
</pre></div>
</div>
<p>Ren'Py's string interpolation is taken from the <span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-3101"><strong>PEP 3101</strong></a> string
formatting syntax. Ren'Py uses [ to introduce string formatting
because { was taken by text tags.</p>
<p>Along with the !s and !r conversion flags supported by Python, Ren'Py
supports !q and !t conversion flag. The !q conversion flag ensures that
text tags are properly quoted, so that displaying a string will not
introduce unwanted formatting constructs. For example:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"Don't pull a fast one on me, [playername!q]."</span>
</pre></div>
</div>
<p>The !t flag will translate the interpolated string:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">if</span> <span class="n">points</span> <span class="o">></span> <span class="mi">5</span><span class="p">:</span>
<span class="k">$</span> <span class="n">mood</span> <span class="o">=</span> <span class="n">_</span><span class="p">(</span><span class="s">"happy"</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">$</span> <span class="n">mood</span> <span class="o">=</span> <span class="n">_</span><span class="p">(</span><span class="s">"annoyed"</span><span class="p">)</span>
<span class="n">g</span> <span class="s">"I'm [mood!t] to see you."</span>
</pre></div>
</div>
</div>
<div class="section" id="styling-and-text-tags">
<h2>Styling and Text Tags<a class="headerlink" href="#styling-and-text-tags" title="Permalink to this headline">¶</a></h2>
<p>In Ren'Py, text gains style information in two ways. The first is from
the style that is applied to the entire block of text. Please see the
section about the <a class="reference internal" href="style.html#styles"><em>style system</em></a> for more details,
especially the section on <a class="reference internal" href="style_properties.html#text-style-properties"><em>text style properties</em></a>.</p>
<p>The second way is through text tags. Text tags are suitable for
styling a portion of text block, or a small fraction of the text
blocks in the program. If you find yourself applying the same text
tags to every line of text, consider using a style instead.</p>
<p>There are two text tags. Some text tags are self-closing, while others
require a closing tag. When multiple closing tags are used, they
should be closed last open, first closed order - Ren'Py will reject
incorrect nesting. For example:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="c"># This line is correct.</span>
<span class="s">"Plain {b}Bold {i}Bold-Italic{/i} Bold{/b} Plain"</span>
<span class="c"># This line is incorrect, and will cause an error or incorrect</span>
<span class="c"># behavior.</span>
<span class="s">"Plain {b}Bold {i}Bold-Italic{/b} Italic{/i} Plain"</span>
</pre></div>
</div>
<p>Some text tags take an argument. In that case, the tag name is
followed by an equals sign (=), and the argument. The argument may
not contain the right-brace (}) character. The meaning of the
argument varies based on the text tag.</p>
<div class="section" id="general-text-tags">
<h3>General Text Tags<a class="headerlink" href="#general-text-tags" title="Permalink to this headline">¶</a></h3>
<p>Tags that apply to all text are:</p>
<dl class="text-tag">
<dt id="text-tag-a">
<tt class="descname">a</tt><a class="headerlink" href="#text-tag-a" title="Permalink to this definition">¶</a></dt>
<dd><p>The anchor tag creates a hyperlink between itself and its closing
tag. While the behavior of the hyperlink is controlled by the
<a class="reference internal" href="style_properties.html#style-property-hyperlink_functions"><tt class="xref std std-propref docutils literal"><span class="pre">hyperlink_functions</span></tt></a> style property, the default handler
has the following behavior.</p>
<ul class="simple">
<li>Hyperlinks are rendered using the <tt class="docutils literal"><span class="pre">style.hyperlink_text</span></tt> style.</li>
<li>If the argument begins with the text <tt class="docutils literal"><span class="pre">"http://"</span></tt>, clicking on
it opens the url in a web browser. Otherwise, the argument is
interpreted as a label, which is called in a new context. This
allows hyperlinks to be used to define terms.</li>
<li>Apart from the change in style, there is no specific behavior
when a hyperlink is hovered.</li>
</ul>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">label</span> <span class="n">test</span><span class="p">:</span>
<span class="n">e</span> <span class="s">"Why don't you visit {a=http://renpy.org}Ren'Py's home page{/a}?"</span>
<span class="n">e</span> <span class="s">"The {a=define_trebuchet}trebuchet{/a} is at the gates."</span>
<span class="k">return</span>
<span class="k">label</span> <span class="n">define_trebuchet</span><span class="p">:</span>
<span class="n">e</span> <span class="s">"A trebuchet is a kind of siege engine."</span>
<span class="n">e</span> <span class="s">"It uses a lever to fling things at targets."</span>
<span class="n">e</span> <span class="s">"Like us!"</span>
<span class="k">return</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-b">
<tt class="descname">b</tt><a class="headerlink" href="#text-tag-b" title="Permalink to this definition">¶</a></dt>
<dd><p>The bold tag renders the text between itself and its closing tag
in a bold font.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"An example of {b}bold test{/b}."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-color">
<tt class="descname">color</tt><a class="headerlink" href="#text-tag-color" title="Permalink to this definition">¶</a></dt>
<dd><p>The color text tag renders the text between itself and its closing
tag in the specified color. The color should be in #rgb, #rgba,
#rrggbb, or #rrggbbaa format.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"{color=#f00}Red{/color}, {color=#00ff00}Green{color}, {color=#0000ffff}Blue{/color}"</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-cps">
<tt class="descname">cps</tt><a class="headerlink" href="#text-tag-cps" title="Permalink to this definition">¶</a></dt>
<dd><p>The characters per second tag sets the speed of text display, for
text between the tag and its closing tag. If the argument begins
with an asterisk, it's taken as a multiplier to the current text
speed. Otherwise, the argument gives the speed to show the text
at, in characters per second.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"{cps=20}Fixed Speed{/cps} {cps=*2}Double Speed{/cps}</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-font">
<tt class="descname">font</tt><a class="headerlink" href="#text-tag-font" title="Permalink to this definition">¶</a></dt>
<dd><p>The font tag renders the text between itself and its closing tag
in the specified font. The argument is the filename of the font to
use.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Try out the {font=mikachan.ttf}mikachan font{/font}."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-i">
<tt class="descname">i</tt><a class="headerlink" href="#text-tag-i" title="Permalink to this definition">¶</a></dt>
<dd><p>The italics tag renders the text between itself and its closing tag
in italics.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Visit the {i}leaning tower of Pisa{/i}."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-k">
<tt class="descname">k</tt><a class="headerlink" href="#text-tag-k" title="Permalink to this definition">¶</a></dt>
<dd><p>The kerning tag is a tag that adjust the kerning of characters
between itself and its closing tag. It takes as an argument a
floating point number giving the number of pixels of kerning to add
to each kerning pair. (The number may be negative to decrease
kerning.)</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"{k=-.5}Negative{/k} Normal {k=.5}Positive{/k}"</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-image">
<tt class="descname">image</tt><a class="headerlink" href="#text-tag-image" title="Permalink to this definition">¶</a></dt>
<dd><p>The image tag is a self-closing tag that inserts an image into the
text. The image should be the height of a single line of text. The
argument should be either the image filename, or the name of an
image defined with the image statement.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"Good to see you! {image=heart.png}"</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-s">
<tt class="descname">s</tt><a class="headerlink" href="#text-tag-s" title="Permalink to this definition">¶</a></dt>
<dd><p>The strikethrough tag draws a line through text between itself and
its closing tag.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"It's good {s}to see you{/s}."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-rb">
<tt class="descname">rb</tt><a class="headerlink" href="#text-tag-rb" title="Permalink to this definition">¶</a></dt>
<dd><p>The ruby bottom tag marks text between itself and its closing tag
as ruby bottom text. See the section on <a class="reference internal" href="#ruby-text"><em>Ruby Text</em></a>
for more information.</p>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-rt">
<tt class="descname">rt</tt><a class="headerlink" href="#text-tag-rt" title="Permalink to this definition">¶</a></dt>
<dd><p>The ruby top tag marks text between itself and its closing tag as
ruby top text. See the section on <a class="reference internal" href="#ruby-text"><em>Ruby Text</em></a> for
more information.</p>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-size">
<tt class="descname">size</tt><a class="headerlink" href="#text-tag-size" title="Permalink to this definition">¶</a></dt>
<dd><p>The size tag changes the size of text between itself and its
closing tag. The argument should be an integer, optionally preceded
by + or -. If the argument is just an integer, the size is set to
that many pixels high. Otherwise, the size is increased or
decreased by that amount.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"{size=+10}Bigger{/size} {size=-10}Smaller{/size} {size=24}24 px{/size}."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-space">
<tt class="descname">space</tt><a class="headerlink" href="#text-tag-space" title="Permalink to this definition">¶</a></dt>
<dd><p>The space tag is a self-closing tag that inserts horizontal space
into a line of text. As an argument, it takes an integer giving the
number of pixels of space to add.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Before the space.{space=30}After the space."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-u">
<tt class="descname">u</tt><a class="headerlink" href="#text-tag-u" title="Permalink to this definition">¶</a></dt>
<dd><p>The underline tag underlines the text between itself and its
closing tag.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"It's good to {u}see{/u} you."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-vspace">
<tt class="descname">vspace</tt><a class="headerlink" href="#text-tag-vspace" title="Permalink to this definition">¶</a></dt>
<dd><p>The vspace tag is a self-closing tag that inserts vertical space
between lines of text. As an argument, it takes an integer giving
the number of pixels of space to add.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Line 1{vspace=30}Line 2"</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-#">
<tt class="descname">#</tt><a class="headerlink" href="#text-tag-#" title="Permalink to this definition">¶</a></dt>
<dd><p>Text tags beginning with # are ignored, but can be included to distinguish
strings for the purpose of translation.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"New{#playlist}"</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="dialogue-text-tags">
<h3>Dialogue Text Tags<a class="headerlink" href="#dialogue-text-tags" title="Permalink to this headline">¶</a></h3>
<p>Text tags that only apply to dialogue are:</p>
<dl class="text-tag">
<dt id="text-tag-fast">
<tt class="descname">fast</tt><a class="headerlink" href="#text-tag-fast" title="Permalink to this definition">¶</a></dt>
<dd><p>If the fast tag is displayed in a line of text, then all text
before it is displayed instantly, even in slow text mode. The
fast tag is a self-closing tag.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"Looks like they're{nw}"</span>
<span class="k">show</span> <span class="n">trebuchet</span>
<span class="n">g</span> <span class="s">"Looks like they're{fast} playing with their trebuchet again."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-nw">
<tt class="descname">nw</tt><a class="headerlink" href="#text-tag-nw" title="Permalink to this definition">¶</a></dt>
<dd><p>The no-wait tag is a self-closing tag that causes the current line
of dialogue to automatically dismiss itself once the end of line
has been displayed.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">g</span> <span class="s">"Looks like they're{nw}"</span>
<span class="k">show</span> <span class="n">trebuchet</span>
<span class="n">g</span> <span class="s">"Looks like they're{fast} playing with their trebuchet again."</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-p">
<tt class="descname">p</tt><a class="headerlink" href="#text-tag-p" title="Permalink to this definition">¶</a></dt>
<dd><p>The paragraph pause tag is a self-closing tag that terminates the
current paragraph, and waits for the user to click to continue. If
it is given an argument, the argument is interpreted as a number,
and the wait automatically ends after that many seconds have
passed.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Line 1{p}Line 2{p=1.0}Line 3"</span>
</pre></div>
</div>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-w">
<tt class="descname">w</tt><a class="headerlink" href="#text-tag-w" title="Permalink to this definition">¶</a></dt>
<dd><p>The wait tag is a self-closing tag that waits for the user to
click to continue. If it is given an argument, the argument is
interpreted as a number, and the wait automatically ends after
that many seconds have passed.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="s">"Line 1{w} Line 1{w=1.0} Line 1"</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="user-defined-text-tags">
<h3>User-Defined Text Tags<a class="headerlink" href="#user-defined-text-tags" title="Permalink to this headline">¶</a></h3>
<p>Ren'Py also supports user-defined text tags. A user-defined text tag
is a text tag where the tag name is empty. In this case, the argument
is taken to be the name of a style. The text between this tag and the
closing tag has the following properties set to those defined in the
style:</p>
<ul class="simple">
<li>antialias</li>
<li>font</li>
<li>size</li>
<li>bold</li>
<li>italic</li>
<li>underline</li>
<li>strikethrough</li>
<li>color</li>
<li>black_color</li>
<li>kerning</li>
</ul>
</div>
</div>
<div class="section" id="non-english-languages">
<h2>Non-English Languages<a class="headerlink" href="#non-english-languages" title="Permalink to this headline">¶</a></h2>
<p>The default font for Ren'Py contains characters for English and many
other languages. For size reasons, it doesn't contain the characters
required to render other languages, including Chinese, Japanese, and
Korean. In order to support these language, a project must first
change the default font, using code like:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">font</span> <span class="o">=</span> <span class="s">"mikachan.ttf"</span>
</pre></div>
</div>
<p>Ren'Py should then support most world languages without further
configuration. However, Korean can be written with or without spacing
between words. Ren'Py has a special mode to support Korean with
spaces, which can be enabled with the code:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">language</span> <span class="o">=</span> <span class="s">"korean-with-spaces"</span>
</pre></div>
</div>
<p>Japanese has multiple rules for line breaking. We recommend starting with
"japanese-normal", and moving to "japanese-loose" or "japanese-strict" for
more or less break opportunities, respectively.:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">language</span> <span class="o">=</span> <span class="s">"japanese-normal"</span>
</pre></div>
</div>
<p>Ideographic languages provide a large number of opportunities
for line breaking. To enable a faster but less-accurate line-breaking
algorithm, use the code:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">layout</span> <span class="o">=</span> <span class="s">"greedy"</span>
</pre></div>
</div>
<p>The faster line-breaking algorithm is not be necessary unless the
game is displaying huge amounts of text, such as in NVL-mode.</p>
<p>The line breaking algorithms can be further configured using the
<tt class="xref py py-func docutils literal"><span class="pre">renpy.language_tailor()</span></tt> function.</p>
<div class="section" id="vertical-text">
<h3>Vertical Text<a class="headerlink" href="#vertical-text" title="Permalink to this headline">¶</a></h3>
<p>When the <a class="reference internal" href="style_properties.html#style-property-vertical"><tt class="xref std std-propref docutils literal"><span class="pre">vertical</span></tt></a> style property is set, Ren'Py will produce
vertically oriented text. The text is written top-to-bottom,
right-to-left.</p>
<p>There are two text tags that interact with vertical text.</p>
<dl class="text-tag">
<dt id="text-tag-horiz">
<tt class="descname">horiz</tt><a class="headerlink" href="#text-tag-horiz" title="Permalink to this definition">¶</a></dt>
<dd><p>Includes horizontally-oriented text inside vertical text.</p>
</dd></dl>
<dl class="text-tag">
<dt id="text-tag-vert">
<tt class="descname">vert</tt><a class="headerlink" href="#text-tag-vert" title="Permalink to this definition">¶</a></dt>
<dd><p>Includes vertically-oriented text inside horizontal text. (This will
not rotate the text to the vertical orientation.)</p>
</dd></dl>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the font does not contain vertical text spacing information, Ren'Py
will attempt to synthesize this information from horizontal text
information. The spacing may not remain constant between Ren'Py
releases.</p>
</div>
</div>
</div>
<div class="section" id="ruby-text">
<span id="id2"></span><h2>Ruby Text<a class="headerlink" href="#ruby-text" title="Permalink to this headline">¶</a></h2>
<p>Ruby text (also known as furigana or interlinear annotations) is a way
of placing small text above a character or word. There are several
steps required for your game to support Ruby text.</p>
<p>First, you must set up styles for the ruby text. The following style
changes are required:</p>
<ol class="arabic simple">
<li>The <a class="reference internal" href="style_properties.html#style-property-line_leading"><tt class="xref std std-propref docutils literal"><span class="pre">line_leading</span></tt></a> property must be used to leave enough
vertical space for the ruby text.</li>
<li>A new named style must be created. The properties of this style,
such as <a class="reference internal" href="style_properties.html#style-property-size"><tt class="xref std std-propref docutils literal"><span class="pre">size</span></tt></a> should be set in a fashion appropriate
for ruby text.</li>
<li>The yoffset of the new style should be set, in order to move the
ruby text above the baseline.</li>
<li>The <a class="reference internal" href="style_properties.html#style-property-ruby_style"><tt class="xref std std-propref docutils literal"><span class="pre">ruby_style</span></tt></a> field of the text's style should be set
to the newly-created style.</li>
</ol>
<p>For example:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">line_leading</span> <span class="o">=</span> <span class="mi">12</span>
<span class="k">style</span><span class="o">.</span><span class="na">ruby_style</span> <span class="o">=</span> <span class="n">Style</span><span class="p">(</span><span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="p">)</span>
<span class="k">style</span><span class="o">.</span><span class="na">ruby_style</span><span class="o">.</span><span class="na">size</span> <span class="o">=</span> <span class="mi">12</span>
<span class="k">style</span><span class="o">.</span><span class="na">ruby_style</span><span class="o">.</span><span class="na">yoffset</span> <span class="o">=</span> <span class="o">-</span><span class="mi">20</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">ruby_style</span> <span class="o">=</span> <span class="k">style</span><span class="o">.</span><span class="na">ruby_style</span>
</pre></div>
</div>
<p>Once Ren'Py has been configured, ruby text can be included using the
rt and rb text tags. The rt tag is used to mark one or more characters
to be displayed as ruby text. If the ruby text is preceded by text
enclosed in the rb tag, the ruby text is centered over that
text. Otherwise, it is centered over the preceding character.</p>
<p>For example:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="n">e</span> <span class="s">"Ruby can be used for furigana (東{rt}とう{/rt} 京{rt}きょう{/rt})."</span>
<span class="n">e</span> <span class="s">"It's also used for translations ({rb}東京{/rb}{rt}Tokyo{/rt})."</span>
</pre></div>
</div>
<p>It's the creator's responsibility to ensure that ruby text does not
leave the boundaries of the text. It may be necessary to add leading
or spaces to the left and right of the text to prevent these errors
from occurring.</p>
</div>
<div class="section" id="fonts">
<h2>Fonts<a class="headerlink" href="#fonts" title="Permalink to this headline">¶</a></h2>
<p>Ren'Py supports Truetype and Image-Based fonts.</p>
<p>A Truetype font is specified by giving the name of the font file. The
file must be present in the game directory, or one of the archive
files.</p>
<p>Ren'Py also supports Truetype collections that define more than one
font. When accessing a collection, use the 0-based font index,
followed by an at-sign and the file name. For example, "<a class="reference external" href="mailto:0%40font.ttc">0<span>@</span>font<span>.</span>ttc</a>" is
the first font in a collection, "<a class="reference external" href="mailto:1%40font.ttc">1<span>@</span>font<span>.</span>ttc</a>" the second, and so on.</p>
<div class="section" id="font-replacement">
<h3>Font Replacement<a class="headerlink" href="#font-replacement" title="Permalink to this headline">¶</a></h3>
<p>The <a class="reference internal" href="config.html#var-config.font_replacement_map"><tt class="xref std std-var docutils literal"><span class="pre">config.font_replacement_map</span></tt></a> variable is used to map
fonts. The combination of font filename, boldness, and italics is
mapped to a similar combination. This allows a font with proper
italics to be used instead of the automatically-generated italics.</p>
<p>Once such mapping would be to replace the italic version of the Deja
Vu Sans font with the official oblique version. (You'll need to
download the oblique font from the web.):</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="n">config</span><span class="o">.</span><span class="n">font_replacement_map</span><span class="p">[</span><span class="s">"DejaVuSans.ttf"</span><span class="p">,</span> <span class="bp">False</span><span class="p">,</span> <span class="bp">True</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="s">"DejaVuSans-Oblique.ttf"</span><span class="p">,</span> <span class="bp">False</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
</pre></div>
</div>
<p>This mapping can improve the look of italic text.</p>
</div>
<div class="section" id="image-based-fonts">
<h3>Image-Based Fonts<a class="headerlink" href="#image-based-fonts" title="Permalink to this headline">¶</a></h3>
<p>Image based fonts can be registered by calling one of the following
registration functions. Registering an image-based font requires the
specification of a name, size, boldness, italicness, and
underline. When all of these properties match the registered font,
the registered font is used.</p>
<dl class="function">
<dt id="renpy.register_bmfont">
<tt class="descclassname">renpy.</tt><tt class="descname">register_bmfont</tt><big>(</big><em>name=None</em>, <em>size=None</em>, <em>bold=False</em>, <em>italics=False</em>, <em>underline=False</em>, <em>filename=None</em><big>)</big><a class="headerlink" href="#renpy.register_bmfont" title="Permalink to this definition">¶</a></dt>
<dd><p>This registers a BMFont with the given details. Please note that size, bold,
italic, and underline are all advisory (used for matching), and do not
change the appearance of the font.</p>
<p>Please see the <a class="reference external" href="http://www.angelcode.com/products/bmfont/">BMFont home page</a>
for the tool that creates BMFonts. Ren'Py expects that the filename
parameter will be to a file in the BMFont text format, that describes a
32-bit font. The Alpha channel should contain the font information, while
the Red, Green, and Blue channels should be set to one. The image files,
kerning, and other control information is read out of the BMFont file.</p>
<p>We recommend including Latin and General Punctuation as part of your BMFont,
to ensure all of the Ren'Py interface can render.</p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the font being registered, a string.</dd>
<dt><cite>size</cite></dt>
<dd>The size of the font being registered, an integer.</dd>
<dt><cite>bold</cite></dt>
<dd>The boldness of the font being registered, a boolean.</dd>
<dt><cite>italics</cite></dt>
<dd>The italicness of the font being registered, a boolean.</dd>
<dt><cite>underline</cite></dt>
<dd>An ignored parameter.</dd>
<dt><cite>filename</cite></dt>
<dd>The file containing BMFont control information.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="renpy.register_mudgefont">
<tt class="descclassname">renpy.</tt><tt class="descname">register_mudgefont</tt><big>(</big><em>name=None</em>, <em>size=None</em>, <em>bold=False</em>, <em>italics=False</em>, <em>underline=False</em>, <em>filename=None</em>, <em>xml=None</em>, <em>spacewidth=10</em>, <em>default_kern=0</em>, <em>kerns={}</em><big>)</big><a class="headerlink" href="#renpy.register_mudgefont" title="Permalink to this definition">¶</a></dt>
<dd><p>This registers a MudgeFont with the given details. Please note that size,
bold, italic, and underline are all advisory (used for matching), and do not
change the appearance of the font.</p>
<p>Please see the <a class="reference external" href="http://www.larryhastings.com/programming/mudgefont/">MudgeFont home page</a>
for the tool that creates MudgeFonts. Ren'Py assumes that character codes
found in the MudgeFont xml file are unicode character numbers, and ignores
negative character codes.</p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the font being registered, a string.</dd>
<dt><cite>size</cite></dt>
<dd>The size of the font being registered, an integer.</dd>
<dt><cite>bold</cite></dt>
<dd>The boldness of the font being registered, a boolean.</dd>
<dt><cite>italics</cite></dt>
<dd>The italicness of the font being registered, a boolean.</dd>
<dt><cite>underline</cite></dt>
<dd>An ignored parameter.</dd>
<dt><cite>filename</cite></dt>
<dd>The file containing the MudgeFont image, a string. The image is usually
a TGA file, but could be a PNG or other format that Ren'PY supports.</dd>
<dt><cite>xml</cite></dt>
<dd>The xml file containing information generated by the MudgeFont tool.</dd>
<dt><cite>spacewidth</cite></dt>
<dd>The width of a space character, an integer in pixels.</dd>
<dt><cite>default_kern</cite></dt>
<dd>The default kern spacing between characters, in pixels.</dd>
<dt><cite>kerns</cite></dt>
<dd>A map from two-character strings to the kern that should be used between
those characters.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="renpy.register_sfont">
<tt class="descclassname">renpy.</tt><tt class="descname">register_sfont</tt><big>(</big><em>name=None</em>, <em>size=None</em>, <em>bold=False</em>, <em>italics=False</em>, <em>underline=False</em>, <em>filename=None</em>, <em>spacewidth=10</em>, <em>default_kern=0</em>, <em>kerns={}</em>, <em>charset=u'!"#$%&'()*+</em>, <em>-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'</em><big>)</big><a class="headerlink" href="#renpy.register_sfont" title="Permalink to this definition">¶</a></dt>
<dd><p>This registers an SFont with the given details. Please note that size, bold,
italic, and underline are all advisory (used for matching), and do not
change the appearance of the font.</p>
<p><a class="reference external" href="http://www.linux-games.com/sfont/">More information about SFont.</a></p>
<dl class="docutils">
<dt><cite>name</cite></dt>
<dd>The name of the font being registered, a string.</dd>
<dt><cite>size</cite></dt>
<dd>The size of the font being registered, an integer.</dd>
<dt><cite>bold</cite></dt>
<dd>The boldness of the font being registered, a boolean.</dd>
<dt><cite>italics</cite></dt>
<dd>The italicness of the font being registered, a boolean.</dd>
<dt><cite>underline</cite></dt>
<dd>An ignored parameter.</dd>
<dt><cite>filename</cite></dt>
<dd>The file containing the sfont image, a string.</dd>
<dt><cite>spacewidth</cite></dt>
<dd>The width of a space character, an integer in pixels.</dd>
<dt><cite>default_kern</cite></dt>
<dd>The default kern spacing between characters, in pixels.</dd>
<dt><cite>kerns</cite></dt>
<dd>A map from two-character strings to the kern that should be used between
those characters.</dd>
<dt><cite>charset</cite> - The character set of the font. A string containing characters in</dt>
<dd><p class="first">the order in which they are found in the image. The default character
set for a SFont is:</p>
<div class="last highlight-renpy"><div class="highlight"><pre><span class="err">!</span> <span class="s">" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?</span>
<span class="err">@</span> <span class="n">A</span> <span class="n">B</span> <span class="n">C</span> <span class="n">D</span> <span class="n">E</span> <span class="n">F</span> <span class="n">G</span> <span class="n">H</span> <span class="n">I</span> <span class="n">J</span> <span class="n">K</span> <span class="n">L</span> <span class="n">M</span> <span class="n">N</span> <span class="n">O</span> <span class="n">P</span> <span class="n">Q</span> <span class="n">R</span> <span class="n">S</span> <span class="n">T</span> <span class="n">U</span> <span class="n">V</span> <span class="n">W</span> <span class="n">X</span> <span class="n">Y</span> <span class="n">Z</span> <span class="p">[</span> \ <span class="p">]</span> <span class="o">^</span> <span class="n">_</span>
<span class="err">`</span> <span class="n">a</span> <span class="n">b</span> <span class="n">c</span> <span class="n">d</span> <span class="n">e</span> <span class="n">f</span> <span class="n">g</span> <span class="n">h</span> <span class="n">i</span> <span class="n">j</span> <span class="n">k</span> <span class="n">l</span> <span class="n">m</span> <span class="n">n</span> <span class="n">o</span> <span class="n">p</span> <span class="n">q</span> <span class="n">r</span> <span class="n">s</span> <span class="n">t</span> <span class="n">u</span> <span class="n">v</span> <span class="n">w</span> <span class="n">x</span> <span class="n">y</span> <span class="n">z</span> <span class="p">{</span> <span class="o">|</span> <span class="p">}</span> <span class="o">~</span>
</pre></div>
</div>
</dd>
</dl>
</dd></dl>
<p>As BMFont is the most complete of the three image font formats Ren'Py
supports, it's the one recommended for new projects. An example of
BMFont use is:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="n">renpy</span><span class="o">.</span><span class="n">register_bmfont</span><span class="p">(</span><span class="s">"bmfont"</span><span class="p">,</span> <span class="mi">22</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">"bmfont.fnt"</span><span class="p">)</span>
<span class="k">define</span> <span class="n">ebf</span> <span class="o">=</span> <span class="n">Character</span><span class="p">(</span><span class="s">'Eileen'</span><span class="p">,</span> <span class="n">what_font</span><span class="o">=</span><span class="s">"bmfont"</span><span class="p">,</span> <span class="n">what_size</span><span class="o">=</span><span class="mi">22</span><span class="p">)</span>
<span class="k">label</span> <span class="n">demo_bmfont</span><span class="p">:</span>
<span class="n">ebf</span> <span class="s">"Finally, Ren'Py supports BMFonts."</span>
</pre></div>
</div>
</div>
<div class="section" id="font-groups">
<h3>Font Groups<a class="headerlink" href="#font-groups" title="Permalink to this headline">¶</a></h3>
<p>When creating a multilingual game, it may not be possible to find a single
font that covers every writing system the game use while projecting the
the mood the creator intends. To support this, Ren'Py supports font groups
that can take characters from two or more fonts and combine them into a
single font.</p>
<p>To create a font group, create a FontGroup object and call the .add method
on it once or more. a FontGroup can be used wherever a font name can be
used. The add method takes the start and end of a range of unicode character
points, and the first range to cover a point is used.</p>
<p>For example:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">init</span> <span class="k">python</span><span class="p">:</span>
<span class="k">style</span><span class="o">.</span><span class="na">default</span><span class="o">.</span><span class="na">font</span> <span class="o">=</span> <span class="n">FontGroup</span><span class="p">()</span><span class="o">.</span><span class="k">add</span><span class="p">(</span><span class="s">"english.ttf"</span><span class="p">,</span> <span class="mh">0x0020</span><span class="p">,</span> <span class="mh">0x007f</span><span class="p">)</span><span class="o">.</span><span class="k">add</span><span class="p">(</span><span class="s">"japanese.ttf"</span><span class="p">,</span> <span class="mh">0x0000</span><span class="p">,</span> <span class="mh">0xffff</span><span class="p">)</span>
</pre></div>
</div>
<dl class="function">
<dt id="FontGroup">
<tt class="descname">FontGroup</tt><big>(</big><big>)</big><a class="headerlink" href="#FontGroup" title="Permalink to this definition">¶</a></dt>
<dd><p>A group of fonts that can be used as a single font.</p>
<dl class="function">
<dt id="add">
<tt class="descname">add</tt><big>(</big><em>font</em>, <em>start</em>, <em>end</em><big>)</big><a class="headerlink" href="#add" title="Permalink to this definition">¶</a></dt>
<dd><p>Associates a range of characters with a <cite>font</cite>.</p>
<dl class="docutils">
<dt><cite>start</cite></dt>
<dd>The start of the range. This may be a single-character string, or
an integer giving a unicode code point.</dd>
<dt><cite>end</cite></dt>
<dd>The end of the range. This may be a single-character string, or an
integer giving a unicode code point.</dd>
</dl>
<p>When multiple .add() calls include the same character, the first call
takes precedence.</p>
<p>This returns the FontGroup, so that multiple calls to .add() can be
chained together.</p>
</dd></dl>
</dd></dl>
</div>
</div>
<div class="section" id="text-displayable">
<h2>Text Displayable<a class="headerlink" href="#text-displayable" title="Permalink to this headline">¶</a></h2>
<p>Text can also be used as a <a class="reference internal" href="displayables.html#displayables"><em>displayable</em></a>, which
allows you to apply transforms to text, displaying it as if it was an
image and moving it around the screen.</p>
<dl class="function">
<dt id="Text">
<tt class="descname">Text</tt><big>(</big><em>text</em>, <em>slow=None</em>, <em>scope=None</em>, <em>substitute=None</em>, <em>slow_done=None</em>, <em>**properties</em><big>)</big><a class="headerlink" href="#Text" title="Permalink to this definition">¶</a></dt>
<dd><p>A displayable that displays text on the screen.</p>
<dl class="docutils">
<dt><cite>text</cite></dt>
<dd>The text to display on the screen. This may be a string, or a list of
strings and displayables.</dd>
<dt><cite>slow</cite></dt>
<dd>Determines if the text is displayed slowly, being typed out one character at the time.
If None, slow text mode is determined by the <a class="reference internal" href="style_properties.html#style-property-slow_cps"><tt class="xref std std-propref docutils literal"><span class="pre">slow_cps</span></tt></a> style property. Otherwise,
the truth value of this parameter determines if slow text mode is used.</dd>
<dt><cite>scope</cite></dt>
<dd>If not None, this should be a dictionary that provides an additional scope for text
interpolation to occur in.</dd>
<dt><cite>substitute</cite></dt>
<dd>If true, text interpolation occurs. If false, it will not occur. If
None, they are controlled by <a class="reference internal" href="config.html#var-config.new_substitutions"><tt class="xref std std-var docutils literal"><span class="pre">config.new_substitutions</span></tt></a>.</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="slow-text-concerns">
<h2>Slow Text Concerns<a class="headerlink" href="#slow-text-concerns" title="Permalink to this headline">¶</a></h2>
<p>Ren'Py allows the creator or user to indicate that text should be
displayed slowly. In this case, Ren'Py will render the text to a
texture, and then draw rectangles from the texture to the screen.</p>
<p>Unfortunately, this means that it's possible to get rendering
artifacts when characters overlap. To minimize these rendering
artifacts, ensure that the <a class="reference internal" href="style_properties.html#style-property-line_leading"><tt class="xref std std-propref docutils literal"><span class="pre">line_leading</span></tt></a> and
<a class="reference internal" href="style_properties.html#style-property-line_spacing"><tt class="xref std std-propref docutils literal"><span class="pre">line_spacing</span></tt></a> properties are large enough that lines do not
overlap. If the bottoms of characters on the first line are clipped,
espeically if line_spacing is negative, consider increasing
<a class="reference internal" href="style_properties.html#style-property-line_overlap_split"><tt class="xref std std-propref docutils literal"><span class="pre">line_overlap_split</span></tt></a>.</p>
<p>Horizontal artifacts are also possible when characters are kerned
together, but these artifacts are less severe, as they exist for only
a single frame.</p>
<p>Artifacts aren't a problem for static text, like the text in menus and
other parts of the user interface.</p>
<div class="section" id="text-overflow-logging">
<h3>Text Overflow Logging<a class="headerlink" href="#text-overflow-logging" title="Permalink to this headline">¶</a></h3>
<p>Ren'Py can log cases where text expands outside of the area allocated
for it. To enable text overflow logging, the following steps are
necessary.</p>
<ol class="arabic simple">
<li>Set the <a class="reference internal" href="config.html#var-config.debug_text_overflow"><tt class="xref std std-var docutils literal"><span class="pre">config.debug_text_overflow</span></tt></a> variable to true.</li>
<li>Set the <a class="reference internal" href="style_properties.html#style-property-xmaximum"><tt class="xref std std-propref docutils literal"><span class="pre">xmaximum</span></tt></a> and <a class="reference internal" href="style_properties.html#style-property-ymaximum"><tt class="xref std std-propref docutils literal"><span class="pre">ymaximum</span></tt></a> style properties on either the Text
displayable, or a container enclosing it.</li>
<li>Run the game.</li>
</ol>
<p>Whenever text is displayed that overflows the available area, Ren'Py
will log an error to the <tt class="docutils literal"><span class="pre">text_overflow.txt</span></tt> file.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="translation.html" title="Translation"
>next</a> |</li>
<li class="right" >
<a href="voice.html" title="Voice"
>previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
</body>
</html>
|