MultiLine View related questions.



  • Hi,

    I have two questions regarding the multiline view.

    1- How can I offset the glyph sequence inside the view? I want the glyphs to appear lower than the border of the view. I can add new line glyph on top, but that also gets affected by setting the line height which is not desireable.

    2- How can I avoid line breaks when glyphs reach the border. I tried to setDisplayStates using the following dictionary but it doesn't have any effect. Am I missing something?

    OPTIONS = {'displayMode': 'Single Line',
    'Show Kerning': True,
    'Multi Line': False,
    'xHeight Cut': False,
    'Water Fall': False,
    'Single Line': True,
    'Inverse': False,
    'Show Metrics': False,
    'Left to Right': False,
    'Right to Left': True,
    'Center': True,
    'Upside Down': False,
    'Stroke': False,
    'Fill': True,
    'Beam': False,
    'Guides': False,
    'Blues': False,
    'Family Blues': False,
    'Show Control glyphs': False,
    'Show Space Matrix': False,
    'Show Template Glyphs': False,
    'showLayers': []}
    

    Thanks


  • admin

    hello @bahman,

    1. the origin position is defined in a private attribute of the naked glyphLineView, there’s no public API for it yet. it’s a single buffer value which is used for both x and y origin:

    from mojo.UI import CurrentSpaceCenter
    S = CurrentSpaceCenter()
    S.glyphLineView._glyphLineView._buffer = 20 # default is 15
    S.updateGlyphLineView()
    

    (this is a bit hacky, use it with care ;)

    2. the Single Line View option should display a single line without any breaks (horizontal scrolling). this works for me:

    from mojo.UI import CurrentSpaceCenter
    sp = CurrentSpaceCenter()
    states = sp.glyphLineView.getDisplayStates()
    states['displayMode'] = "Single Line"
    sp.glyphLineView.setDisplayStates(states)
    

    please give it a try… thanks!



  • Hello @gferreira

    1. Thank you! This works very well. Right now it's only one value, If there will be a method to specify all the borders it would be perfect (left, right, top, bottom).

    2. Thanks, this works too. Is it possible to disable line breaks in Multi-Line mode so the remaining text goes outside the view?



  • This is a complete hack but you can fake a non-breaking multiline by changing the width.

    from mojo.UI import CurrentSpaceCenter
    sc = CurrentSpaceCenter()
    xywh = list(sc.glyphLineView.getPosSize())
    xywh[2] = 10000
    sc.glyphLineView.setPosSize(xywh)
    

    and separate x/y controls for _buffer would be great



  • Well that was fast... from the beta posted immediately after I hit Submit

    from mojo.UI import CurrentSpaceCenter
    sc = CurrentSpaceCenter()
    x, y = sc.getOffset()
    sc.setOffset((x, y*2))
    

  • admin

    r e a d i n g y o u r m i n d r i g h t n o w



  • Thank you for this!


Log in to reply