Class BidiUtils

java.lang.Object
org.sejda.sambox.util.BidiUtils

public final class BidiUtils extends Object
see http://translationtherapy.com/understanding-how-to-work-with-bi-directionality-bidi-text/ and https://docs.oracle.com/javase/tutorial/2d/text/textlayoutbidirectionaltext.html for some info related to BiDi contents
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • MIRRORING_CHAR_MAP

      private static Map<Character,Character> MIRRORING_CHAR_MAP
  • Constructor Details

    • BidiUtils

      private BidiUtils()
  • Method Details

    • visualToLogical

      public static String visualToLogical(String text)
      Handles the LTR and RTL direction of the given words. The whole implementation stands and falls with the given word. If the word is a full line, the results will be the best. If the word contains of single words or characters, the order of the characters in a word or words in a line may wrong, due to RTL and LTR marks and characters! Based on http://www.nesterovsky-bros.com/weblog/2013/07/28/VisualToLogicalConversionInJava.aspx
      Parameters:
      text - The word that shall be processed
      Returns:
      new word with the correct direction of the containing characters
    • parseBidiFile

      private static void parseBidiFile(InputStream inputStream)
      This method parses the bidi file provided as inputstream.
      Parameters:
      inputStream - - The bidi file as inputstream
      Throws:
      IOException - if any line could not be read by the LineNumberReader