Skip to content

Commit

Permalink
Fix shy #1313 (#1319)
Browse files Browse the repository at this point in the history
* Fixed bugs regardings soft hyphen handling and simplified the code.

* Fixed left-align, right-align, center-align.

* Fixed jusitied alignment, mostly. It does not work correctly in all cases, because letter-spacing is not applied between letters of the same word at style boundaries.
  • Loading branch information
hvbtup committed Jun 12, 2023
1 parent ef1f26c commit bc427ee
Show file tree
Hide file tree
Showing 8 changed files with 553 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Provides the interfaces for the Text Content Text content contains several
* paragraphs which shares the same style properties.
*
* If the text contain serveral return characters and the display is inline, it
* If the text contain several return characters and the display is inline, it
* is treated as "INLINE-BLOCK" otherwise it is "INLINE".
*
* If the display is "block", it is "BLOCK" always.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,6 @@ public class Word {
protected int end;
protected String text;

private boolean keepTrailingSoftHyphen = true;

/**
* Should a trailing Unicode SOFT HYPHEN (SHY) symbol be kept or omitted?
*
* @return true if a trailing soft hyphen should be kept, false if it should be
* omitted.
*
* @since 4.13
*/
public boolean isKeepTrailingSoftHyphen() {
return keepTrailingSoftHyphen;
}

/**
* Set whether a trailing Unicode SOFT HYPHEN (SHY) symbol should be kept or
* omitted. The default value is <tt>true</tt>, so this is usually only called
* to omit it.
*
* @apiNote This is not really used inside the Word class. But a Word object is
* used to transmit the information piggyback to the
* {@link org.eclipse.birt.report.engine.nLayout.area.impl.TextArea}
* object, where the information is needed.
*
* @param keepTrailingSoftHyphen whether to keep the last soft hyphen or not.
*
* @since 4.13
*/
public void setKeepTrailingSoftHyphen(boolean keepTrailingSoftHyphen) {
this.keepTrailingSoftHyphen = keepTrailingSoftHyphen;
}

/**
* Create a Word instance as a substring of a given text.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

import com.ibm.icu.text.Bidi;

/**
* A Chunk is a piece of text and formatting metadata like what font to use and
* BIDI setting. The font info is needed for computing width and height.
*/
public class Chunk {
private String text;
private int offset;
Expand Down Expand Up @@ -92,7 +96,7 @@ public int getBaseLevel() {
}

/**
* Sets direction of this chunk.
* Sets run level of this chunk.
*
* @param runLevel An integer value from 0 to 62
*
Expand Down
Loading

0 comments on commit bc427ee

Please sign in to comment.