mirror of
https://github.com/apache/poi.git
synced 2025-02-08 02:58:18 +00:00
[bug-64605] add support for non-integer font sizes on character runs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879949 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d928ac58a8
commit
cb1d9a0061
@ -48,7 +48,9 @@ public interface CharacterRun {
|
||||
void setImprinted(boolean imprint);
|
||||
|
||||
int getFontSize();
|
||||
float getFontSizeAsFloat();
|
||||
void setFontSize(int halfPoints);
|
||||
void setFontSize(float halfPoints);
|
||||
|
||||
int getCharacterSpacing();
|
||||
void setCharacterSpacing(int twips);
|
||||
|
@ -28,6 +28,9 @@ import org.apache.poi.hwpf.model.StyleSheet;
|
||||
import org.apache.poi.hwpf.sprm.SprmBuffer;
|
||||
import org.apache.poi.util.Removal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* This class represents a run of text that share common properties.
|
||||
*/
|
||||
@ -349,6 +352,11 @@ public final class CharacterRun extends Range implements Duplicatable, org.apach
|
||||
return _props.getHps();
|
||||
}
|
||||
|
||||
public float getFontSizeAsFloat()
|
||||
{
|
||||
return (float)getFontSize();
|
||||
}
|
||||
|
||||
public void setFontSize(int halfPoints)
|
||||
{
|
||||
_props.setHps(halfPoints);
|
||||
@ -357,6 +365,11 @@ public final class CharacterRun extends Range implements Duplicatable, org.apach
|
||||
|
||||
}
|
||||
|
||||
public void setFontSize(float halfPoints)
|
||||
{
|
||||
setFontSize(BigDecimal.valueOf(halfPoints).setScale(0, RoundingMode.HALF_UP).intValue());
|
||||
}
|
||||
|
||||
public int getCharacterSpacing()
|
||||
{
|
||||
return _props.getDxaSpace();
|
||||
|
Loading…
x
Reference in New Issue
Block a user