File: README.md

package info (click to toggle)
libtext-layout-perl 0.045-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 548 kB
  • sloc: perl: 4,117; makefile: 2
file content (100 lines) | stat: -rw-r--r-- 2,958 bytes parent folder | download | duplicates (2)
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
# Text::Layout
![Version](https://img.shields.io/github/v/release/sciurius/perl-Text-Layout)
![GitHub issues](https://img.shields.io/github/issues/sciurius/perl-Text-Layout)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
![Language Perl](https://img.shields.io/badge/Language-Perl-blue)



**WARNING: Some parts of the API are changing in incompatible ways. If you
(want to) use this module for serious work please contact me.**

Text::Layout provides methods for Pango style text formatting. Where
possible the methods have identical names and (near) identical
behaviour as their Pango counterparts.

Text::Layout uses backend modules to render the marked up text.
Backends are included for:

*  PDF::API2  (functional)
*  PDF::Builder  (functional)
*  Markdown  (minimal functionality)

Note that the Pango and Cairo backends are discontinued.

The package uses Text::Layout::FontConfig (included) to organize fonts
by description.

If module HarfBuzz::Shaper is installed, Text::Layout can use it for
text shaping.

## Example

    # Create a PDF document.
    my $pdf = PDF::API2->new;	# or PDF::Builder->new
    $pdf->default_page_size("a4");

    # Set up page and get the text context.
    my $page = $pdf->page;
    my $ctx  = $page->text;

    # Create a markup instance, passing the PDF context.
    my $layout = Text::Layout->new($pdf);

    # This example uses PDF corefonts only.
    Text::Layout::FontConfig->register_corefonts;

    $layout->set_font_description(Text::Layout::FontConfig->from_string("times 40"));
    $layout->set_markup( q{The <i><span foreground="red">quick</span> <span size="20"><b>brown</b></span></i> fox} );

    # Center text.
    $layout->set_width(595);	# width of A4 page
    $layout->set_alignment("center");

    # Render it, passing the text context.
    $layout->show( $x, $y, $ctx );

# SEE ALSO

Description of the Pango Markup Language:
https://docs.gtk.org/Pango/pango_markup.html#pango-markup.

Documentation of the Pango Layout class:
https://docs.gtk.org/Pango/class.Layout.html.

# FUTURE DIRECTIONS

Text::Layout was originally inspired by the Pango Markup Language 
and provided a Pango compatibility mode.
However, both implementations have significantly diversed.
As a result, the Pango compatibility mode will be removed in some
future version.

# INSTALLATION

To install this module, run the following commands:

	perl Makefile.PL
	make
	make test
	make install

# SUPPORT AND DOCUMENTATION

Development of this module takes place on GitHub:
https://github.com/sciurius/perl-Text-Layout.

You can find documentation for this module with the perldoc command.

    perldoc Text::Layout

Please report any bugs or feature requests using the issue tracker on
GitHub.

# COPYRIGHT AND LICENCE

Copyright (C) 2019,2024 Johan Vromans

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.