public ICULineBreaker(Locale locale) { this.breaker = BreakIterator.getLineInstance(locale); }
public ICULineBreaker(Locale locale) { this.breaker = BreakIterator.getLineInstance(locale); }
/** * Creates a reader that breaks an input text to fit in a given width. * * @param reader the buffered reader for the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixels) where the text has to fit in */ private LineBreakingReader(BufferedReader reader, GC gc, int maxLineWidth) { fReader= reader; fGC= gc; fMaxWidth= maxLineWidth; fOffset= 0; fLine= null; fLineBreakIterator= BreakIterator.getLineInstance(); fBreakWords= true; }
/** * Creates a reader that breaks an input text to fit in a given width. * * @param reader the buffered reader for the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixels) where the text has to fit in */ private LineBreakingReader(BufferedReader reader, GC gc, int maxLineWidth) { fReader= reader; fGC= gc; fMaxWidth= maxLineWidth; fOffset= 0; fLine= null; fLineBreakIterator= BreakIterator.getLineInstance(); fBreakWords= true; }
/** * Returns a new instance of BreakIterator that locates legal line- * wrapping positions. This function assumes the text being broken * is in the default locale's language. * @return A new instance of BreakIterator that locates legal * line-wrapping positions. * @stable ICU 2.0 */ public static BreakIterator getLineInstance() { return getLineInstance(Locale.getDefault()); }
/** * Returns a new instance of BreakIterator that locates legal line- * wrapping positions. This function assumes the text being broken * is in the default locale's language. * @return A new instance of BreakIterator that locates legal * line-wrapping positions. * @stable ICU 2.0 */ public static BreakIterator getLineInstance() { return getLineInstance(Locale.getDefault()); }
/** * Creates a reader that breaks an input text to fit in a given width. * * @param reader Reader of the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixels) where the text has to fit in */ public LineBreakingReader(Reader reader, GC gc, int maxLineWidth) { fReader= new BufferedReader(reader); fGC= gc; fMaxWidth= maxLineWidth; fOffset= 0; fLine= null; fLineBreakIterator= BreakIterator.getLineInstance(); fBreakWords= true; }
/** * Creates a reader that breaks an input text to fit in a given width. * * @param reader Reader of the input text * @param gc The graphic context that defines the currently used font sizes * @param maxLineWidth The max width (pixes) where the text has to fit in */ public LineBreakingReader(Reader reader, GC gc, int maxLineWidth) { _fReader = new BufferedReader(reader); _fGC = gc; _fMaxWidth = maxLineWidth; _fOffset = 0; _fLine = null; _fLineBreakIterator = BreakIterator.getLineInstance(); }
/** * Returns a new instance of BreakIterator that locates legal line- * wrapping positions. This function assumes the text being broken * is in the default locale's language. * @return A new instance of BreakIterator that locates legal * line-wrapping positions. * @stable ICU 2.0 */ public static BreakIterator getLineInstance() { return getLineInstance(ULocale.getDefault()); }
@Override public BreakIterator getLineInstance(Locale locale) { com.ibm.icu.text.BreakIterator icuBrkItr = com.ibm.icu.text.BreakIterator.getLineInstance( ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale)); return BreakIteratorICU.wrap(icuBrkItr); }
private void computeTextFragments(GC gc) { if (textFragments != null) return; ArrayList<TextFragment> list = new ArrayList<>(); BreakIterator wb = BreakIterator.getLineInstance(); wb.setText(getText()); int cursor = 0; for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) { if (loc == 0) continue; String word = text.substring(cursor, loc); Point extent = gc.textExtent(word); list.add(new TextFragment((short) loc, (short) extent.x)); cursor = loc; } textFragments = list.toArray(new TextFragment[list .size()]); }
private void computeTextFragments(GC gc) { if (textFragments != null) return; ArrayList<TextFragment> list = new ArrayList<>(); BreakIterator wb = BreakIterator.getLineInstance(); wb.setText(getText()); int cursor = 0; for (int loc = wb.first(); loc != BreakIterator.DONE; loc = wb.next()) { if (loc == 0) continue; String word = text.substring(cursor, loc); Point extent = gc.textExtent(word); list.add(new TextFragment((short) loc, (short) extent.x)); cursor = loc; } textFragments = list.toArray(new TextFragment[list .size()]); }
private BreakIterator createBreakIterator() { ULocale locale = ULocale.forLanguageTag(this.locale); if ("line".equals(granularity)) { // "strictness" cannot be set through unicode extensions (u-lb-strict), handle here: locale = locale.setKeywordValue("lb", strictness); } BreakIterator breakIterator; switch (granularity) { case "grapheme": breakIterator = BreakIterator.getCharacterInstance(locale); break; case "word": breakIterator = BreakIterator.getWordInstance(locale); break; case "sentence": breakIterator = BreakIterator.getSentenceInstance(locale); break; case "line": breakIterator = BreakIterator.getLineInstance(locale); break; default: throw new AssertionError(); } return breakIterator; }
break; case BI_LINE: bitr = BreakIterator.getLineInstance(brkLocale); break; case BI_SENTENCE: