Tabnine Logo
TextNode
Code IndexAdd Tabnine to your IDE (free)

How to use
TextNode
in
org.apache.batik.bridge

Best Java code snippets using org.apache.batik.bridge.TextNode (Showing top 20 results out of 315)

origin: org.apache.xmlgraphics/batik-bridge

public List getTextRuns(TextNode node, AttributedCharacterIterator aci) {
  List textRuns = node.getTextRuns();
  if (textRuns != null) {
    return textRuns;
  }
  AttributedCharacterIterator[] chunkACIs = getTextChunkACIs(aci);
  textRuns = computeTextRuns(node, aci, chunkACIs);
  // cache the textRuns so don't need to recalculate
  node.setTextRuns(textRuns);
  return node.getTextRuns();
}
origin: fr.avianey.apache-xmlgraphics/batik

public void setSelection(Mark begin, Mark end) {
  TextNode node = begin.getTextNode();
  if (node != end.getTextNode()) {
    throw new Error("Markers not from same TextNode");
  }
  node.setSelection(begin, end);
  selectionNode = node;
  selectionNodeRoot = node.getRoot();
  Object selection = getSelection();
  Shape  shape     = node.getHighlightShape();
  dispatchSelectionEvent(new SelectionEvent
    (selection, SelectionEvent.SELECTION_DONE, shape));
}
origin: apache/fop

/**
 * Create a text element bridge.
 *
 * This set the text painter on the node if the text is simple.
 * @param ctx the bridge context
 * @param e the svg element
 * @return the text graphics node created by the super class
 */
public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
  GraphicsNode node = super.createGraphicsNode(ctx, e);
  if (node != null) {
    //Set our own text painter
    ((TextNode)node).setTextPainter(textPainter);
  }
  return node;
}
origin: org.apache.xmlgraphics/batik-bridge

/**
 * Sets the location of this text node.
 *
 * @param newLocation the new location of this text node
 */
public void setLocation(Point2D newLocation){
  fireGraphicsNodeChangeStarted();
  invalidateGeometryCache();
  this.location = newLocation;
  fireGraphicsNodeChangeCompleted();
}
origin: org.apache.xmlgraphics/batik-bridge

/**
 * Retrieve the list of layout for the
 * text node.
 */
protected List getTextRuns(TextNode node){
  //System.out.println(node.getTextRuns());
  if ( node.getTextRuns() == null ){
    //TODO : need to work out a solution
    //to compute the text runs
    node.getPrimitiveBounds();
  }
  //System.out.println(node.getTextRuns());
  return node.getTextRuns();
}
origin: apache/batik

/**
 * Selects the first glyph in the text node.
 */
public Mark selectFirst(TextNode node) {
  AttributedCharacterIterator aci;
  aci = node.getAttributedCharacterIterator();
  if (aci == null)
    return null;
  TextHit textHit = new TextHit(aci.getBeginIndex(), false);
  return new BasicTextPainter.BasicMark(node, textHit);
}
origin: fr.avianey.apache-xmlgraphics/batik

String text    = textNode.getText();
String pattern = search.getText();
if (!caseSensitive.isSelected()) {
  textNode.getAttributedCharacterIterator();
aci.first();
for (int i=0; i < end; ++i) {
  aci.next();
Mark startMark = textNode.getMarkerForChar(aci.getIndex(), true);
Mark endMark = textNode.getMarkerForChar(aci.getIndex(), false);
svgCanvas.select(startMark, endMark);
Shape s = textNode.getHighlightShape();
AffineTransform at;
if (highlightCenterZoomButton.isSelected()) {
origin: fr.avianey.apache-xmlgraphics/batik

List list = tn.getTextRuns();
if (list == null)
  return elems;
origin: fr.avianey.apache-xmlgraphics/batik

List list = tn.getTextRuns();
if (list == null)
  return false;
AffineTransform at = tn.getGlobalTransform();
at.preConcatenate(ati);
tnRect = tn.getBounds();
tnRect = at.createTransformedShape(tnRect).getBounds2D();
if (!rect.intersects(tnRect)) return false;
origin: org.apache.xmlgraphics/batik-bridge

protected void rebuildACI() {
  if (hasNewACI)
    return;
  TextNode textNode = getTextNode();
  if (textNode.getAttributedCharacterIterator() == null)
    return;
  TextPaintInfo pi, oldPI;
  if ( cssProceedElement == e ){
    pi = new TextPaintInfo();
    setBaseTextPaintInfo(pi, e, node, ctx);
    setDecorationTextPaintInfo(pi, e);
    oldPI = (TextPaintInfo)elemTPI.get(e);
  } else {
    //if a child CSS property has changed, then
    //retrieve the parent text decoration
    //and only update the section of the AtrtibutedString of
    //the child
    TextPaintInfo parentPI;
    parentPI = getParentTextPaintInfo(cssProceedElement);
    pi = getTextPaintInfo(cssProceedElement, textNode, parentPI, ctx);
    oldPI = (TextPaintInfo)elemTPI.get(cssProceedElement);
  }
  if (oldPI == null) return;
  textNode.swapTextPaintInfo(pi, oldPI);
  if (usingComplexSVGFont)
    // Force Complex SVG fonts to be recreated
    textNode.setAttributedCharacterIterator
      (textNode.getAttributedCharacterIterator());
}
origin: org.apache.xmlgraphics/batik-bridge

  node.setTextPainter(ctx.getTextPainter());
hints = CSSUtilities.convertTextRendering (e, hints);
if (hints != null)
  node.setRenderingHints(hints);
node.setLocation(getLocation(ctx, e));
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Returns true if the specified Point2D is inside the boundary of this
 * node, false otherwise.
 *
 * @param p the specified Point2D in the user space
 */
public boolean contains(Point2D p) {
  // <!> FIXME: should put this code in TextPaint somewhere,
  // as pointer-events support - same problem with pointer-events
  // and ShapeNode
  if (!super.contains(p)) {
    return false;
  }
  List list = getTextRuns();
  // place coords in text node coordinate system
  for (int i = 0 ; i < list.size(); i++) {
    StrokingTextPainter.TextRun run =
      (StrokingTextPainter.TextRun)list.get(i);
    TextSpanLayout layout = run.getLayout();
    float x = (float)p.getX();
    float y = (float)p.getY();
    TextHit textHit = layout.hitTestChar(x, y);
    if (textHit != null && contains(p, layout.getBounds2D())) {
      return true;
    }
  }
  return false;
}
origin: org.apache.xmlgraphics/batik-bridge

/**
 * Select an ensemble of characters for that element.
 *
 * TODO : report the selection to the selection
 *  manager in JSVGComponent.
 */
protected void selectSubString(Element element, int charnum, int nchars) {
  TextNode textNode = getTextNode();
  AttributedCharacterIterator aci;
  aci = textNode.getAttributedCharacterIterator();
  if (aci == null)
    return;
  int firstChar = getElementStartIndex(element);
  if ( firstChar == -1 )
    return;
  List list = getTextRuns(textNode);
  int lastChar = getElementEndIndex(element);
  CharacterInformation firstInfo, lastInfo;
  firstInfo = getCharacterInformation(list, firstChar,charnum,aci);
  lastInfo  = getCharacterInformation(list, firstChar,charnum+nchars-1,aci);
  Mark firstMark, lastMark;
  firstMark = textNode.getMarkerForChar(firstInfo.characterIndex,true);
  if ( lastInfo != null && lastInfo.characterIndex <= lastChar ){
    lastMark = textNode.getMarkerForChar(lastInfo.characterIndex,false);
  }
  else{
    lastMark = textNode.getMarkerForChar(lastChar,false);
  }
  ctx.getUserAgent().setTextSelection(firstMark,lastMark);
}
origin: apache/fop

/**
 * Paints the specified attributed character iterator using the
 * specified Graphics2D and context and font context.
 *
 * @param node the TextNode to paint
 * @param g2d the Graphics2D to use
 */
public void paint(TextNode node, Graphics2D g2d) {
  if (isSupportedGraphics2D(g2d)) {
    new TextRunPainter().paintTextRuns(node.getTextRuns(), g2d, node.getLocation());
  }
  proxyTextPainter.paint(node, g2d);
}
origin: org.apache.xmlgraphics/batik-bridge

int currentChunk = 0;
Point2D location = node.getLocation();
do {
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Creates the GraphicsNode depending on the GraphicsNodeBridge
 * implementation.
 */
protected GraphicsNode instantiateGraphicsNode() {
  return new TextNode();
}
origin: fr.avianey.apache-xmlgraphics/batik

/**
 * Sets the location of this text node.
 *
 * @param newLocation the new location of this text node
 */
public void setLocation(Point2D newLocation){
  fireGraphicsNodeChangeStarted();
  invalidateGeometryCache();
  this.location = newLocation;
  fireGraphicsNodeChangeCompleted();
}
origin: org.apache.xmlgraphics/batik-bridge

/**
 * Selects the first glyph in the text node.
 */
public Mark selectFirst(TextNode node) {
  AttributedCharacterIterator aci;
  aci = node.getAttributedCharacterIterator();
  if (aci == null)
    return null;
  TextHit textHit = new TextHit(aci.getBeginIndex(), false);
  return new BasicTextPainter.BasicMark(node, textHit);
}
origin: apache/batik

String text    = textNode.getText();
String pattern = search.getText();
if (!caseSensitive.isSelected()) {
  textNode.getAttributedCharacterIterator();
aci.first();
for (int i=0; i < end; ++i) {
  aci.next();
Mark startMark = textNode.getMarkerForChar(aci.getIndex(), true);
Mark endMark = textNode.getMarkerForChar(aci.getIndex(), false);
svgCanvas.select(startMark, endMark);
Shape s = textNode.getHighlightShape();
AffineTransform at;
if (highlightCenterZoomButton.isSelected()) {
origin: org.apache.xmlgraphics/batik-bridge

List list = tn.getTextRuns();
if (list == null)
  return elems;
org.apache.batik.bridgeTextNode

Javadoc

A graphics node that represents text.

Most used methods

  • getTextRuns
    Returns a list of text runs.
  • getAttributedCharacterIterator
    Returns the attributed character iterator of this text node.
  • getHighlightShape
    Returns the shape used to outline this text node.
  • getLocation
    Returns the location of this text node.
  • getMarkerForChar
    Return the marker for the character at index in this nodes AttributedCharacterIterator. Before Char
  • setTextPainter
    Sets the text painter of this text node. If the specified text painter is null, this text node will
  • setTextRuns
    Sets the list of text runs of this text node.
  • <init>
    Constructs a new empty TextNode.
  • contains
  • fireGraphicsNodeChangeCompleted
  • fireGraphicsNodeChangeStarted
  • getBounds
  • fireGraphicsNodeChangeStarted,
  • getBounds,
  • getGeometryBounds,
  • getGlobalTransform,
  • getPrimitiveBounds,
  • getRenderingHints,
  • getRoot,
  • getText,
  • invalidateGeometryCache,
  • setAttributedCharacterIterator

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JLabel (javax.swing)
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now