Options
Hyphenation
hyphenLanguage
- Each language break words at different points. These point can be calculated faily accurately by using hyphenation patterns.
- Full list of available hyphenation languages found here.
<!-- Hyphenation pattern - english -->
<script src="https://unpkg.com/@fluid-project/hyphenation-patterns@0.2.2-dev.20181115T211247Z.d313a52/dist/browser/en-us.js"></script>// Default: US english
'hyphenLanguage': 'en-us'// Disable hyphenation
'hyphenLanguage': ''hyphenLeftMin
- Words can hyphenate after a single letter. We can define a minimum number of characters before words are allowed to hyphenate.
- Example "hyphenate" breaks at these points: "hy-phen-ate".
// Default: minimum number of characters on left side of word.
'hyphenLeftMin': 2- If there is too much hyphenation, this can reduced by increasing the value.
- Increasing the value to 3 would update "hyphenate" to break at these points: "hyphen-ate".
// Increase to lower hyphenation rate.
'hyphenLeftMin': 4hyphenRightMin
- Words can hyphenate after a single letter. We can define a minimum number of characters before words are allowed to hyphenate.
- Example "hyphenate" breaks at these points: "hy-phen-ation".
// Default: minimum number of characters on right side of word.
'hyphenRightMin': 2- If there is too much hyphenation, this can reduced by increasing the value.
- Increasing the value to 4 would update "hyphenate" to break at these points: "hy-phenate".
// Increase to lower hyphenation rate.
'hyphenRightMin': 4Algorithm
alignment
- Alignment defines how text is presented.
- This is not purely style as the rate of hyphenation is more acceptable with certain alignment.
// Default: justified as it is generally more readable.
'alignment': 'justify' // options: 'left', 'right', 'center'hyphenPenalty and hyphenPenaltyRagged
- Penalty is the algorithmic discouragement of a certain behavior.
- Increaing the hyphenPenalty makes it less like for hyphenation to occur on justified text.
- Increaing the hyphenPenaltyRagged makes it less like for hyphenation to occur on left, right and center aligned text.
// Default:
'hyphenPenalty': 50,
'hyphenPenaltyRagged': 500flagPenalty
- Penalty is the algorithmic discouragement of a certain behavior.
- Increaing the flagPenalty makes it less like for hyphenation to occur 2 lines in a row.
// Default:
'flagPenalty': 3000fitnessClassDemerit
- Demerit is the algorithmic discouragement of a certain behavior.
- Increaing the flagPenalty makes it less like for lines to have different length.
// Default:
'fitnessClassDemerit': 3000fitnessClasses
- Fitness class is a definition of how much word-spacing there is on a given line.
- The purpose is to limit how much the text goes from: a lot of word-spacing, to very little word-spacing.
// Default:
'fitnessClasses': [-1, -0.5, 0.5, 1, Infinity]demeritOffset
- The demerit offset is added to help differentiate between multiple good solutions, by increasing the penalty of all solutions.
- Increaing the demeritOffset will possibly help differentiate good solutions. Increase it too much and it's harder to differentiate good from bad solutions.
// Default:
'fitnessClassDemerit': 1maxRatio
- Adjustment ratio is a value to represent how much word-spacing there is compared to length of line and number of words in line.
- The maxRatio adjustment ratio defines when there is too much word-spacing on a line that it is not a valid solution.
- Increase the value will negatively affect performance, decrease value can possibly make performance better or worse.
// Default:
'maxRatio': 2minRatio
- Adjustment ratio is a value to represent how much word-spacing there is compared to length of line and number of words in line.
- The minRatio adjustment ratio defines when there is too little word-spacing on a line that it is not a valid solution.
- Increase the value if the text appears with too little word-spacing.
// Default:
'minRatio': -1absoluteMaxRatio
- If no valid solution is found the algorithm will rerun with an increased maxRatio.
- The absoluteMaxRatio defines when the algorithm should stop looking for solutions.
- If the text is very narrow this value can be increased to allow more spacing between words for the final solution.
// Default:
'absoluteMaxRatio': 5unsupportedTags
- List of HTML tags that is not supported by TypesetBot.
- If you experience problems will a certain HTML tag, add it to the list and it will be remove before the typesetting is run.
- Tag names should be written in uppercase.
// Default:
'unsupportedTags': ['BR', 'IMG'];Font
spaceWidth
- Ideal word-spacing based on the font size in.
- Increase value to prefer more word-spacing.
- Decrease value to prefer less word-spacing.
// Default:
'spaceWidth': 1 / 3 // 0.3333, 1/3 of the font-sizespaceStretchability
- How much should the word-spacing be able to stretch from the ideal space width.
- Increase value to allow more word-spacing.
// Default:
'spaceStretchability': 1 / 6 // 1/6 of the font-sizespaceShrinkability
- How much should the word-spacing be able to shrink from the ideal space width.
- Increase value to allow less word-spacing.
// Default:
'spaceShrinkability': 1 / 9 // 1/9 of the font-sizeDebug properties
debug
- Debug mode to print performance statistics of TypesetBot.
- Set to true to enable mode.
// Default:
'debug': false // Set to true to enablenoRun
- Set this setting to true, so avoid running TypesetBot as soon as the instance is created.
// Default:
'noRun': false // Set to true to enablelogs
- Define how many logs levels should be printed in the console.
- By default only error and warnings will be shown.
- To show all log messages
// Default:
'logs': ['error', 'warn'],
// Example; Show all log messages:
'logs': ['error', 'warn', 'log'],
// Example; Show only errors:
'logs': ['error'],