Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojox/gfx/VectorText.js

  • Provides:

    • dojox.gfx.VectorText
  • Requires:

    • dojox.gfx in common
    • dojox.xml.DomParser in common
    • dojox.html.metrics in common
  • dojox.gfx.vectorFontFitting

    • type
      Object
  • dojox.gfx.vectorFontFitting.NONE

    • type
      Number
  • dojox.gfx.vectorFontFitting.FLOW

    • type
      Number
  • dojox.gfx.vectorFontFitting.FIT

    • type
      Number
  • dojox.gfx.defaultVectorText

    • type
      Object
  • dojox.gfx.defaultVectorText.type

    • type
      String
  • dojox.gfx.defaultVectorText.x

    • type
      Number
  • dojox.gfx.defaultVectorText.y

    • type
      Number
  • dojox.gfx.defaultVectorText.width

    • type
      Object
  • dojox.gfx.defaultVectorText.height

    • type
      Object
  • dojox.gfx.defaultVectorText.text

    • type
      String
  • dojox.gfx.defaultVectorText.align

    • type
      String
  • dojox.gfx.defaultVectorText.decoration

    • type
      String
  • dojox.gfx.defaultVectorText.fitting

    • type
      Number
  • dojox.gfx.defaultVectorText.leading

    • type
      Number
  • dojox.gfx.defaultVectorFont

    • type
      Object
  • dojox.gfx.defaultVectorFont.type

    • type
      String
  • dojox.gfx.defaultVectorFont.size

    • type
      String
  • dojox.gfx.defaultVectorFont.family

    • type
      Object
  • dojox.gfx._vectorFontCache

    • type
      Object
  • dojox.gfx._svgFontCache

    • type
      Object
  • dojox.gfx.getVectorFont

    • parameters:
      • url: (typeof String)
    • type
      Function
  • dojox.gfx.VectorFont

    • type
      Function
    • parameters:
      • url: (typeof String|dojo._Url)
    • summary
      Create this font object based on the SVG Font definition at url.
  • dojox.gfx.VectorFont._entityRe

    • type
      RegExp
  • dojox.gfx.VectorFont._decodeEntitySequence

    • parameters:
      • str
    • returns
      undefined|String
    • type
      Function
  • dojox.gfx.VectorFont._parse

    • parameters:
      • svg: (typeof String)
      • url: (typeof String)
    • summary
      Take the loaded SVG Font definition file and convert the info
      into things we can use. The SVG Font definition must follow
      the SVG 1.1 Font specification.
    • type
      Function
  • dojox.gfx.VectorFont._clean

    • summary
      Clean off all of the given mixin parameters.
    • type
      Function
  • dojox.gfx.VectorFont.name

  • dojox.gfx.VectorFont.family

  • dojox.gfx.VectorFont.constructor

    • constructor - constructor
    • type
      Function
    • parameters:
      • url: (typeof String|dojo._Url)
    • summary
      Create this font object based on the SVG Font definition at url.
  • dojox.gfx.VectorFont.load

    • parameters:
      • url: (typeof String|dojo._Url)
    • returns
      dojox.gfx.VectorFont
    • summary
      Load the passed SVG and send it to the parser for parsing.
    • type
      Function
  • dojox.gfx.VectorFont.initialized

    • returns
      Boolean
    • summary
      Return if we've loaded a font def, and the parsing was successful.
    • type
      Function
  • dojox.gfx.VectorFont._round

    • parameters:
      • n
    • type
      Function
  • dojox.gfx.VectorFont._leading

    • parameters:
      • unit
    • type
      Function
  • dojox.gfx.VectorFont._normalize

    • parameters:
      • str
    • type
      Function
  • dojox.gfx.VectorFont._getWidth

    • parameters:
      • glyphs
    • type
      Function
  • dojox.gfx.VectorFont._getLongestLine

    • parameters:
      • lines
    • type
      Function
  • dojox.gfx.VectorFont._trim

    • parameters:
      • lines
    • type
      Function
  • dojox.gfx.VectorFont._split

    • parameters:
      • chars
      • nLines
    • summary
      split passed chars into nLines by finding the closest whitespace.
    • type
      Function
  • dojox.gfx.VectorFont._getSizeFactor

    • parameters:
      • size
    • type
      Function
  • dojox.gfx.VectorFont.viewbox.height

  • dojox.gfx.VectorFont._getFitFactor

    • parameters:
      • lines
      • w
      • h
      • l
    • summary
      Find the scaling factor for the given phrase set.
    • type
      Function
  • dojox.gfx.VectorFont._getBestFit

    • parameters:
      • chars
      • w
      • h
      • ldng
    • summary
      Get the best number of lines to return given w and h.
    • type
      Function
  • dojox.gfx.VectorFont._getBestFlow

    • parameters:
      • chars
      • w
      • scale
    • summary
      Based on the given scale, do the best line splitting possible.
    • type
      Function
  • dojox.gfx.VectorFont.getWidth

    • parameters:
      • text: (typeof String)
      • scale: (typeof Float)
    • summary
      Get the width of the rendered text without actually rendering it.
    • type
      Function
  • dojox.gfx.VectorFont.getLineHeight

    • parameters:
      • scale: (typeof Float)
    • returns
      Float
    • summary
      return the height of a single line, sans leading, based on scale.
    • type
      Function
  • dojox.gfx.VectorFont.getCenterline

    • parameters:
      • scale: (typeof Float)
    • summary
      return the y coordinate that is the center of the viewbox.
    • type
      Function
  • dojox.gfx.VectorFont.getBaseline

    • parameters:
      • scale: (typeof Float)
    • returns
      Float
    • summary
      Find the baseline coord for alignment; adjust for scale if passed.
    • type
      Function
  • dojox.gfx.VectorFont.draw

    • parameters:
      • group: (typeof dojox.gfx.Container)
      • textArgs: (typeof dojox.gfx.__TextArgs)
      • fontArgs: (typeof dojox.gfx.__FontArgs)
      • fillArgs: (typeof dojox.gfx.__FillArgs)
      • strokeArgs: (typeof dojox.gfx.__StrokeArgs)
    • returns
      dojox.gfx.Group
    • summary
      based on the passed parameters, draw the given text using paths
      defined by this font.
    • description
      The main method of a VectorFont, draw() will take a text fragment
      and render it in a set of groups and paths based on the parameters
      passed.
      
      The basics of drawing text are simple enough: pass it your text as
      part of the textArgs object, pass size and family info as part of
      the fontArgs object, pass at least a color as the fillArgs object,
      and if you are looking to create an outline, pass the strokeArgs
      object as well. fillArgs and strokeArgs are the same as any other
      gfx fill and stroke arguments; they are simply applied to any path
      object generated by this method.
      
      Resulting GFX structure
      -----------------------
      
      The result of this function is a set of gfx objects in the following
      structure:
      
      	dojox.gfx.Group 			//	the parent group generated by this function
      	+	dojox.gfx.Group[]		//	a group generated for each line of text
      		+	dojox.gfx.Path[]	//	each glyph/character in the text
      
      Scaling transformations (i.e. making the generated text the correct size)
      are always applied to the parent Group that is generated (i.e. the top
      node in the above example).  In theory, if you are looking to do any kind
      of other transformations (such as a translation), you should apply it to
      the group reference you pass to this method.  If you find that you need
      to apply transformations to the group that is returned by this method,
      you will need to reapply the scaling transformation as the *last* transform,
      like so:
      
      	textGroup.setTransform(new dojox.gfx.Matrix2D([
      		dojox.gfx.matrix.translate({ dx: dx, dy: dy }),
      		textGroup.getTransform()
      	]));
      
      In general, this should never be necessary unless you are doing advanced
      placement of your text.
      
      Advanced Layout Functionality
      -----------------------------
      
      In addition to straight text fragments, draw() supports a few advanced
      operations not normally available with vector graphics:
      
      * Flow operations (i.e. wrap to a given width)
      * Fitting operations (i.e. find a best fit to a given rectangle)
      
      To enable either, pass a `fitting` property along with the textArgs object.
      The possible values are contained in the dojox.gfx.vectorFontFitting enum
      (NONE, FLOW, FIT).
      
      `Flow fitting`
      Flow fitting requires both a passed size (in the fontArgs object) and a
      width (passed with the textArgs object).  draw() will attempt to split the
      passed text up into lines, at the closest whitespace according to the
      passed width.  If a width is missing, it will revert to NONE.
      
      `Best fit fitting`
      Doing a "best fit" means taking the passed text, and finding the largest
      size and line breaks so that it is the closest fit possible.  With best
      fit, any size arguments are ignored; if a height is missing, it will revert
      to NONE.
      
      Other notes
      -----------
      
      `a11y`
      Since the results of this method are rendering using pure paths (think
      "convert to outlines" in Adobe Illustrator), any text rendered by this
      code is NOT considered a11y-friendly.  If a11y is a requirement, we
      suggest using other, more a11y-friendly methods.
      
      `Font sources`
      Always make sure that you are legally allowed to use any fonts that you
      convert to SVG format; we claim no responsibility for any licensing
      infractions that may be caused by the use of this code.
    • type
      Function
  • dojox.gfx.VectorFont.onLoadBegin

    • parameters:
      • url: (typeof String)
    • type
      Function
  • dojox.gfx.VectorFont.onLoad

    • parameters:
      • font: (typeof dojox.gfx.VectorFont)
    • type
      Function
  • dojox.gfx.VectorFont._defaultLeading

    • type
      Number
  • dojox.gfx.VectorText

    • type
      Object
  • dojox.gfx

    • type
      Object
  • dojox

    • type
      Object