Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

C++ layouting library inspired by TeX

License

NotificationsYou must be signed in to change notification settings

strandfield/typeset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

libtypeset is a C++ library that aims at providing an abstract layouting enginesuitable for typesetting complex documents.

The library is heavily inspired byTeX, thetypesetting system designed byDonald Knuth.It currently implements many of the primitives present in the language including boxes,glue, kerns and penalties.

Typesetting text

The Qt framework is used to provide some examples of typesetting text.

Albeit being extremely simple, the concepts of boxes and glue turn out tobe also incredibly powerful.They make text justification an easy task while also allowing particularspacing rules out of the box.

The following picture shows how a single line of text can be rendered onpages with different width.First the line is rendered on its ideal page width, then the page width isincreased respectively by 15% and 25%.

Image: single line text-typesetting

Notice how the spacing rules are different after a comma or a period.Here, the interword space increase 50% faster after a comma and 100%faster after a period, hence making the space after a period almost twiceas large as a regular space.

libtypeset also provides a basic implementation of TeX linebreaking algorithm.This algorithm is used to break a paragraph of text into a series of line.

Animation: linebreaking

Unlike a naive algorithm which would consider each line independently,TeX linebreaking algorithm considers the paragraph as a whole to producemore aesthetic results.Indeed, the basic strategy that consists of filling a line with as muchtext as possible and then going to the next line may produce lineswith too few words that will look bad.TeX tries to avoid such situations by sometimes putting fewer words thanpossible on a line to make the next lines look better.The whole process is in fact an optimisation problem: the algorithm triesto minimise a cost (in the context of TeX, this cost is called the demerit).

About

C++ layouting library inspired by TeX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp