Font Editor in custom plugin

  1. 4 days ago

    David Z

    Nov 13 Pre-Release Testers, Xojo Pro

    Is there any way to use the native Xojo font options inside of a custom plugin?

    For example, I have a property called TextFont and it appears in the proper section in the Inspector. However, as opposed to the drop-down list of fonts that Xojo native controls produce, I simply have a text input to write in the value.

    Any guidance would be appreciated.

    Yes you can
    Make sure you have

       Public Property TextSize as Integer
       Public Property Bold as boolean
       Public Property Italic as boolean
       Public Property TextFont as String
       Public Property TextUnit as FontUnits
       Public Property Underline as boolean

    And that in your property definitions you put them all in a group named "Font"
    That should be all you need

  2. Derk J

    Nov 13 Pre-Release Testers, Xojo Pro
    Edited 4 days ago

    Font names:
    Font(index) As String
    FontCount As Integer

    That should give you font names, from the system.

    You might be able to parse it to the plugin or handle it differently. Not sure if this help you for coding a Plugin .

  3. David Z

    Nov 13 Pre-Release Testers, Xojo Pro

    Hey Derk,

    Thanks for the quick reply. I understand how to find the current font inside of standard functions and methods. I'm trying to find out if it's specifically possible to replicate the font options in the Inspector for a custom plugin.

    How it looks in the inspector now:
    -image-

    How I'd like it to be if possible:
    -image-

  4. Derk J

    Nov 13 Pre-Release Testers, Xojo Pro
    Edited 4 days ago

    you want to re-draw the IDE using a self coded plugin ?
    Or do you want to make a Control using a Plugin for font selection?

  5. David Z

    Nov 13 Pre-Release Testers, Xojo Pro

    I have a custom plugin I've written. It's a control and it allows the end user to adjust the font used, text size, etc. Similar to many of the baked in Xojo controls.

    Xojo handles the presentation of these attributes with a very clean editor in the Inspector. There is a dropdown menu for all available font choices, an input for the text size, checkboxes for bold and italic, etc.

    It is unclear if there is a way to frame my properties of TextFont, TextSize, etc in a way that will allow the Inspector to take control of those values with the Inspector's Font Editor (picture 2)

  6. Tim P

    Nov 13 Pre-Release Testers, Xojo Pro ⭐️

    @Norman P might have insight.

  7. Norman P

    Nov 13 Xojo Inc Answer

    Yes you can
    Make sure you have

       Public Property TextSize as Integer
       Public Property Bold as boolean
       Public Property Italic as boolean
       Public Property TextFont as String
       Public Property TextUnit as FontUnits
       Public Property Underline as boolean

    And that in your property definitions you put them all in a group named "Font"
    That should be all you need

  8. Emile S

    Nov 13 Europe (France, Strasbourg)

    @David Z How I'd like it to be if possible:

    Bold, Italic and Underline (…) are no more styles (on macOS, I do not know for Linux and Windows): you have to have these fonts to be able to use them.

    They usually appears as:
    Times The regular Font
    Times-Bold The regular Font in Bold
    Times-Italic The regular Font in Italic
    Times-Underline The regular Font in Underline

    So, the “proposed” desing is wrong IMHO.

  9. Norman P

    Nov 13 Xojo Inc

    You should try it Emile
    Subclass canvas
    Add those properties
    Make sure you reveal them in the property inspector in the group as I noted

  10. 3 days ago

    David Z

    Nov 13 Pre-Release Testers, Xojo Pro

    Thank You Norman! I was missing the the TextUnit. This is fantastic!

or Sign Up to reply!