Changeset 615 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 12/12/13 17:15:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r613 r615 135 135 private List<Integer> _lineOffsets = new LinkedList<Integer>(); 136 136 137 private FontRenderContext frc = null; 137 138 private LineBreakMeasurer _lineBreaker = null; 138 139 … … 1409 1410 .toString()); 1410 1411 paragraphText.addAttribute(TextAttribute.FONT, getPaintFont()); 1411 _lineBreaker = new LineBreakMeasurer(paragraphText.getIterator(),1412 new FontRenderContext(null, true, true));1412 frc = new FontRenderContext(null, true, true); 1413 _lineBreaker = new LineBreakMeasurer(paragraphText.getIterator(), frc); 1413 1414 } 1414 1415 … … 1455 1456 } 1456 1457 width = getLineWidth(getX(), getY(), lines); 1457 1458 if(width < 100) {1459 width = 100;1460 }1461 1458 } else { 1462 1459 width = Float.MAX_VALUE; … … 1472 1469 1473 1470 // --- Get the output of the LineBreakMeasurer and store it in a 1474 while ((layout = _lineBreaker.nextLayout(width)) != null) { 1471 while (_lineBreaker.getPosition() < _text.length()) { 1472 1473 layout = _lineBreaker.nextLayout(width, _text.length(), true); 1475 1474 1476 1475 // lineBreaker does not break on newline … … 1484 1483 if (_text.charAt(i) == '\n') {// || c == '\t'){ 1485 1484 _lineBreaker.setPosition(start); 1486 layout = _lineBreaker.nextLayout(width, i, false);1485 layout = _lineBreaker.nextLayout(width, i, true); 1487 1486 break; 1488 1487 } … … 1490 1489 1491 1490 _lineOffsets.add(_lineBreaker.getPosition()); 1491 1492 if(layout == null) { 1493 layout = new TextLayout(" ", getPaintFont(), frc); 1494 } 1492 1495 1493 1496 if (/* hasWidth() && */getJustification() == Justification.full 1494 1497 && _lineBreaker.getPosition() < _text.length()) 1495 1498 layout = layout.getJustifiedLayout(width); 1496 1499 1497 1500 _textLayouts.add(layout); 1498 1501 1499 1502 if(_autoWrap || UserSettings.AutoWrap) { 1503 1500 1504 if(lineHeight != Float.NaN) { 1501 1505 lineHeight = getLineDrop(layout); 1502 1506 } 1503 width = getLineWidth(getX(), getY() + (lineHeight * (_lineOffsets.size() - 1)), lines); 1504 if(width < 100) { 1505 width = 100; 1506 } 1507 width = getLineWidth(getX(), getY() + (lineHeight * (_textLayouts.size() - 1)), lines); 1507 1508 } 1508 1509 }
Note:
See TracChangeset
for help on using the changeset viewer.