HISE Logo Forum
    • Categories
    • Register
    • Login

    Left centre text alignment

    Scheduled Pinned Locked Moved Feature Requests
    9 Posts 2 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by

      Could we have an option to align the text to the horizontal left and vertical centre? Or separate options for X and Y.

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        You can use the same alignment ids as the Label uses:

        const var Panel1 = Content.addPanel("Panel1", 0, 0);
        
        Panel1.setPaintRoutine(function(g)
        {
        	g.setColour(Colours.white);
        	g.drawAlignedText("Funky", [0, 0, this.getWidth(), this.getHeight()], "left"); // also: topLeft, bottomLeft
        });
        
        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          Actually it's label text I'm wanting to align. I have a label that is larger than the text that it contains (so it conforms to a grid layout) but I'd like the text centred vertically, I can do this by changing the size of the label but that messes with the grid, or I can centre the text horizontally which also centres it vertically but then I have to shift the label left to get it to look left aligned, and that messes with the grid. :)

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            That's precisely why there is the alignment property in the label:

            [
              {
                "type": "ScriptLabel",
                "id": "Label1",
                "x": 32,
                "y": 25,
                "width": 128,
                "height": 28,
                "alignment": "left"
              }
            ]
            
            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              I think I'm not explaining very well. Hopefully this image will help. The text is aligned left, but it is not aligned vertically central which is what I would like.

              0_1511644337172_Screenshot from 2017-11-25 21-11-23.png

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                I really don't get it :) The text is aligned vertically in the centre, isn't it?

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  Maybe it's my eyes but to me it looks like the text is in the lower half of the label rather than central

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    Nah, it's your eyes :)

                    Just kidding, I just take the alignment in JUCE and pass it on to the scripting engine but I trust these guys to get it right :)

                    1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey
                      last edited by

                      I'll just shift it a few pixels manually then until my eyes are happy :)

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      21

                      Online

                      1.8k

                      Users

                      11.9k

                      Topics

                      104.0k

                      Posts