Skip to content
Snippets Groups Projects
Commit 6d4d65a6 authored by Andrey Ruzhanskiy's avatar Andrey Ruzhanskiy
Browse files

Make TextRasterizer mergable again.

parent 20e3083b
No related branches found
No related tags found
1 merge request!24Feat/brailletextrasterizer 38
......@@ -183,7 +183,6 @@ public final class App {
//RasterCanvas canvas = renderer.rasterize(new BrailleText("ABCDabcd23465/%",new Rectangle(0,0,1000,1000)));
SimpleMatrixDataImpl<Boolean> mat = (SimpleMatrixDataImpl<Boolean>) canvas.getCurrentPage();
mLogger.debug("Render preview:\n" + mat.toBoolString());
// SVG exporting
SvgExporter<RasterCanvas> svgExporter = new BoolMatrixDataSvgExporter(canvas);
......
......@@ -111,7 +111,7 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
* @param canvas Canvas on which the text should later appear
* @return Height in dots.
*/
public int calculateRequiredHeight(final String text, final int xPos, final int yPos, int maxWidth,
public int calculateRequiredHeight(final String text, final int xPos, final int yPos, final int maxWidth,
final RasterCanvas canvas) {
TranslationResult result = null;
try {
......@@ -123,10 +123,13 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
}
String sResult = result.getBraille();
int widthOfText = sResult.length();
int tempMaxWidth;
// If its not dividable by two, make it dividable by two;
if (maxWidth % 2 != 0) {
maxWidth--;
tempMaxWidth = maxWidth - 1;
} else {
tempMaxWidth = maxWidth;
}
return (int) ceil(widthOfText / maxWidth);
return (int) ceil(widthOfText / tempMaxWidth);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment