/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.lowagie.geoforge.utils;
import com.lowagie.text.Chunk;
import com.lowagie.text.LwgFont;
import com.lowagie.text.LwgPhrase;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class LwgGfrSubSupScriptUtils
{
static public LwgPhrase getSubScript(
String str,
String strSubscript,
LwgFont fnt,
LwgFont fntSubscript) throws Exception
{
return getSubScript(
str,
strSubscript,
fnt,
fntSubscript,
-3.0f);
}
static public LwgPhrase getSubScript(
String str,
String strSubscript,
LwgFont fnt,
LwgFont fntSubscript,
float fltTextRise) throws Exception
{
LwgPhrase phr = new LwgPhrase();
Chunk c;
c = new Chunk(str, fnt);
c.setTextRise(0f);
phr.add(c);
c = new Chunk(strSubscript, fntSubscript);
c.setTextRise(fltTextRise);
phr.add(c);
return phr;
}
static public LwgPhrase getSupScript(
String str,
String strSupscript,
LwgFont fnt,
LwgFont fntSupscript) throws Exception
{
LwgPhrase phr = new LwgPhrase();
Chunk c;
c = new Chunk(str, fnt);
c.setTextRise(0f);
phr.add(c);
c = new Chunk(strSupscript, fntSupscript);
c.setTextRise(3.0f);
phr.add(c);
return phr;
}
}