「Text rendering using downloadable font」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
This sample code shows how to render text with [[downloadable font>Font]].
In addition to the program, the following files are needed:
- [[Font file]]: file containing font pattern
- [[Font Index file]]: file defining the mapping between [[Font file]] and font name
#center(){Main.java}
#highlight(java){
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import org.dvb.ui.FontFactory;
import org.havi.ui.HScene;
import org.havi.ui.HSceneFactory;
import org.havi.ui.HScreen;
public class Main implements Xlet{
int x = 100, y = 100;
public void initXlet(XletContext context){
try {
Font f;
HScene hs= HSceneFactory.getInstance().getFullScreenScene(
HScreen.getDefaultHScreen().getDefaultHGraphicsDevice());
hs.setVisible(true);
Graphics g = hs.getGraphics();
g.setColor(Color.white);
// Obtaining font instance
f = new FontFactory().createFont("mika", java.awt.Font.PLAIN, 48);
g.setFont(f);
g.drawString("test", x, y); y += 50;
} catch (Throwable thr){
}
}
public void startXlet(){ }
public void pauseXlet(){ }
public void destroyXlet(boolean unconditional){}
}
}
----
* See also
- [[Font]]:describes Downloadable Font
#right(){Tag list: &tags() &counter()}
----
* Message board
#pcomment()
&html(<a href="http://w1.ax.xrea.com/c.f?id=100104052" target="_blank"><img src="http://w1.ax.xrea.com/l.f?id=100104052&url=X" alt="AX" border="0"></a>)
#javascript(){{
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8953544-1");
pageTracker._trackPageview();
} catch(err) {}</script>
}}
This sample code shows how to render text with [[downloadable font>Font]].
In addition to the program, the following files are needed:
- [[Font file]]: file containing font pattern
- [[Font Index file]]: file defining the mapping between [[Font file]] and font name
#center(){Main.java}
#highlight(java){
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import org.dvb.ui.FontFactory;
import org.havi.ui.HScene;
import org.havi.ui.HSceneFactory;
import org.havi.ui.HScreen;
public class Main implements Xlet{
int x = 100, y = 100;
public void initXlet(XletContext context){
try {
Font f;
HScene hs= HSceneFactory.getInstance().getFullScreenScene(
HScreen.getDefaultHScreen().getDefaultHGraphicsDevice());
hs.setVisible(true);
Graphics g = hs.getGraphics();
g.setColor(Color.white);
// Obtaining font instance
f = new FontFactory().createFont("mika", java.awt.Font.PLAIN, 48);
g.setFont(f);
g.drawString("test", x, y); y += 50;
} catch (Throwable thr){
}
}
public void startXlet(){ }
public void pauseXlet(){ }
public void destroyXlet(boolean unconditional){}
}
}
----
* See also
- [[Font]]:describes Downloadable Font
#right(){Tag list: &tags() &counter()}
----
* Message board
#pcomment()
#javascript(){{
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10857512-1");
pageTracker._trackPageview();
} catch(err) {}</script>
}}