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

Upper Case solved

parent 63c9f388
No related branches found
No related tags found
1 merge request!24Feat/brailletextrasterizer 38
......@@ -170,9 +170,9 @@ public final class App {
// Render diagram
MasterRenderer renderer = new MasterRenderer(indexV4Printer, a4Format);
RasterCanvas canvas = renderer.rasterize(barChart);
//renderer.getRenderingBase().registerRasterizer(new FunctionalRasterizer<BrailleText>(BrailleText.class ,new BrailleTextRasterizer()));
//RasterCanvas canvas = renderer.rasterize(new BrailleText("üöä#",new Rectangle(0,0,1000,1000)));
//RasterCanvas canvas = renderer.rasterize(barChart);
renderer.getRenderingBase().registerRasterizer(new FunctionalRasterizer<BrailleText>(BrailleText.class ,new BrailleTextRasterizer()));
RasterCanvas canvas = renderer.rasterize(new BrailleText("A",new Rectangle(0,0,1000,1000)));
SimpleMatrixDataImpl<Boolean> mat = (SimpleMatrixDataImpl<Boolean>) canvas.getCurrentPage();
mLogger.debug("Render preview:\n" + mat.toBoolString());
......
......@@ -38,23 +38,46 @@ public final class BrailleTextRasterizer implements Rasterizer<BrailleText> {
// Loop through
for (int i = 0; i < data.getText().length(); i++) {
// If the char is uppercase, we need to add a special char to signal that the coming braille char is uppercase
// Depended on the used brailletable
// Currently, it is simply converted to lowercase.
// If the char is uppercase, we need to add a special char(CAP) to signal that the coming braille char is uppercase
// Depended on the used brailletable.
if (Character.isUpperCase(textAsArray[i].charAt(0))) {
textAsArray[i] = String.valueOf(Character.toLowerCase(textAsArray[i].charAt(0)));
isUppercase = true;
}
// Letter to be printed to the canvas (braille string representation).
letterAsBraille = mParser.getCharToBraille(textAsArray[i]).split("");
// First cell width, then cell height.
// The string braille is looking like this: 123456
// For reference, the real braille is like this:
// 1 4
// 2 5
// 3 6
rasterizeBrailleCell(letterAsBraille, x, y, canvas);
textAsArray[i] = String.valueOf(Character.toLowerCase(textAsArray[i].charAt(0)));
isUppercase = true;
String[] specialUpperChar = mParser.getCharToBraille("CAP").split("");
rasterizeBrailleCell(specialUpperChar,x,y,canvas);
// Next BrailleCell
x += 2;
// Check if linebreak is needed.
if (x == maxWidth) {
// Jump into the next line
y = y + canvas.getCellHeight();
// Reset x
x = origX;
}
letterAsBraille = mParser.getCharToBraille(textAsArray[i]).split("");
rasterizeBrailleCell(letterAsBraille, x, y, canvas);
// Next BrailleCell
x += 2;
// Check if linebreak is needed.
if (x == maxWidth) {
// Jump into the next line
y = y + canvas.getCellHeight();
// Reset x
x = origX;
}
} else {
// Normalcase
// Letter to be printed to the canvas (braille string representation).
letterAsBraille = mParser.getCharToBraille(textAsArray[i]).split("");
// The string braille is looking like this: 123456
// For reference, the real braille is like this:
// 1 4
// 2 5
// 3 6
rasterizeBrailleCell(letterAsBraille, x, y, canvas);
}
// Next BrailleCell
x += 2;
// Check if linebreak is needed.
......
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