Comments (4)
Are you doing hyphenation? Might be better to save your time if you are. As far as I'm aware hyphenation is avoided in scripts (I think because it'd make for stilted line readings).
from wrap.
Yes and no.
Currently Wrap breaks lines by a greedy algorithm (at some point I might look at something similar to TeX's algorithm but screenplays are very constrained so I'm guessing that wouldn't give much better results).
First we collect cells (which are parts of the source text with certain markup, and are already grouped into lines as in the source file) until the line is full.
If there are too many characters on the line we search for a breakpoint in the last cell. A breakpoint is a Unicode space or a hyphen.
If we don't find a breakpoint we break at the upper limit the line length allows. If there are two letters here we insert a hyphen (most likely in a place where we shoudn't), otherwise we don't (but we probably broke a number in two).
There's a number of issues here:
- The best point to break is often in the cell before the current cell, cases like:
... end of long line compound_word._
where the ideal breakpoint is betweenline
andcompoundword
but Wrap breaks compound and word in two, which might even be a mistake in some cases.
#36 was a special case of this problem, where the last cell had length one. Wrap now backtracks one cell in that case, but ideally we would look to see if the start of the cell is a valid breakpoint before we break there and backtrack as needed. - The current break possibilities are incomplete and even plain wrong (a non-breaking space is also a Unicode space).
- Currently we don't support different line lengths throughout a set of lines. Not a big issue but it does mean that the first line of a parenthetical currently get one character less than it should because of it's indentation.
- When we're forced to break the line at the limit a thing that could be checked first, is if there is another 'less ideal' breakpoint, eg. the first non letter from the right.
A similar set of issues exist for page breaks. Although we don't do anything wrong there, there are only better selection criteria which would try harder to avoid page breaks which break within an element, etc. (see #38)
from wrap.
Thanks, that’s an impressively comprehensive overview!
from wrap.
Started working on this on the linewrap branch. As of now only 3. is fixed.
from wrap.
Related Issues (20)
- Improve page breaks
- Support different page sizes HOT 15
- Additional flags HOT 3
- Potential improvement HOT 1
- Improve code quality
- Command line flags for scene heading format
- Command line flag to toggle title page
- Command line flag to toggle page numbers HOT 2
- Any element following a note element will be parsed as action HOT 3
- Avoid breaking "--" across lines HOT 8
- Request option: turn off PDF hyphenation HOT 1
- Generating a PDF on macOS: "Warning: no Courier Prime installed" HOT 3
- Compare Drafts
- Update the wiki's instructions to install with Go HOT 1
- Pdf generation HOT 1
- Clarify `Type: stageplay` instruction HOT 2
- OOB Read when using empty character and page break HOT 1
- Does not respect forced Action (!) HOT 2
- Title page does not show other key pairs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrap.