26 |
* Written by Benja Fallenstein and Matti J. Katila |
* Written by Benja Fallenstein and Matti J. Katila |
27 |
*/ |
*/ |
28 |
package org.fenfire.view; |
package org.fenfire.view; |
29 |
|
import org.fenfire.view.lava.*; |
30 |
import org.fenfire.swamp.*; |
import org.fenfire.swamp.*; |
31 |
import org.nongnu.alph.*; |
import org.nongnu.alph.*; |
32 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
33 |
|
import org.nongnu.libvob.util.*; |
34 |
import org.nongnu.libvob.vobs.*; |
import org.nongnu.libvob.vobs.*; |
35 |
|
|
36 |
/** A node function returning a vob that shows |
/** A node function returning a vob that shows |
37 |
* the given node as text. |
* the given node as text. |
38 |
*/ |
*/ |
39 |
public class RSTText implements NodeFunction { |
public class RSTText extends TextHandler implements NodeFunction { |
40 |
|
private void p(String s) { System.out.println("RSTText:: "+s); } |
41 |
|
|
42 |
final NodeFunction nodeContent; |
final NodeFunction nodeContent; |
43 |
final TextStyle style; |
final TextStyle style; |
44 |
final float scale; |
final float scale; |
45 |
FenPDFContext context = null; |
private FenPDFContext context = null; |
46 |
|
|
47 |
public void setContext(FenPDFContext context) { |
public void setContext(FenPDFContext context) { |
48 |
this.context = context; |
this.context = context; |
59 |
public Object f(ConstGraph g, Object node) { |
public Object f(ConstGraph g, Object node) { |
60 |
if (context == null) throw new Error("No context set"); |
if (context == null) throw new Error("No context set"); |
61 |
|
|
62 |
|
context.isToBePlaced(node, this); |
63 |
|
p("placed"); |
64 |
|
|
65 |
Enfilade1D enf = (Enfilade1D)nodeContent.f(g, node); |
Enfilade1D enf = (Enfilade1D)nodeContent.f(g, node); |
66 |
|
|
67 |
final Object objNode = node; |
final Object objNode = node; |
68 |
String s = enf.makeString(); |
String s = enf.makeString(); |
69 |
final TextVob vob = new TextVob(style, s, false); |
final TextVob vob = new TextVob(style, s, false, |
70 |
|
"Color " + ColorUtil.colorGLString(color)); |
71 |
final float width = style.getWidth(s, scale); |
final float width = style.getWidth(s, scale); |
72 |
final float height = style.getHeight(scale); |
final float height = style.getHeight(scale); |
73 |
|
|