All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.openhtmltopdf.bidi.support.ICUBreakers Maven / Gradle / Ivy

Go to download

Open HTML to PDF is a CSS 2.1 renderer written in Java. This artifact supports right-to-left text mixed with left-to-right text.

There is a newer version: 1.0.10
Show newest version
package com.openhtmltopdf.bidi.support;

import java.util.Locale;

import com.ibm.icu.text.BreakIterator;
import com.openhtmltopdf.extend.FSTextBreaker;

public class ICUBreakers {
	
	private ICUBreakers() { }
	
	public static class ICULineBreaker implements FSTextBreaker {
		private final BreakIterator breaker;
		
		public ICULineBreaker(Locale locale) {
			this.breaker = BreakIterator.getLineInstance(locale);
		}
		
		@Override
		public int next() {
			return this.breaker.next();
		}

		@Override
		public void setText(String newText) {
			this.breaker.setText(newText);
		}
	}

	public static class ICUCharacterBreaker implements FSTextBreaker {
		private final BreakIterator breaker;
		
		public ICUCharacterBreaker(Locale locale) {
			this.breaker = BreakIterator.getCharacterInstance(locale);
		}
		
		@Override
		public int next() {
			return this.breaker.next();
		}

		@Override
		public void setText(String newText) {
			this.breaker.setText(newText);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy