Page 2 of 3

Re: fontMenu function with submenus

Posted: Fri Aug 09, 2024 3:50 pm
by OpenXTalkPaul
Here's a version that uses the list of common known font style names to do the grouping. It seems to work well enough in reduce the length of the main Font menu. It could be better, I can see a few (see 'Optima ExtraBlack' in the screenshot) that should be added to the common style names list used for filtering.
Obviously this isn't going to get edge cases right, I don't see how it could without some way to extracts the actual family name from the font file.

I'm using an array because I couldn't get the list sorted in a way that a 'no-style' font name came first and was winding up with multiple sub-menus for the same Font Family Name. Using an Array made it much easier to do the grouping and inserting a non-styled (Plain) choice into the sub-menu if there isn't one already.
fontMenu-UsingArray.oxtstack
(16.13 KiB) Downloaded 98 times
Screen Shot 2024-08-09 at 11.47.52 AM.png
Screen Shot 2024-08-09 at 11.47.52 AM.png (248.38 KiB) Viewed 5887 times

Code: Select all

on mouseDown pButtonNumber
   put fontMenu() into me   
end mouseDown

on menuPick pWhich
   replace "|" with " " in pWhich
   if the last word of pWhich = "(Plain)" then delete the last word of pWhich
   set the label of me to  pWhich
   set the textFont of me to pWhich
   set the textFont of fld 1 to pWhich
end menuPick

function fontMenu
   lock screen
   -- Define the "special-purpose" font names to ignore
   put "(Default)" & cr & "(Menu)" & cr & "(Message)" & cr & "(Styled Text)" & cr & "(System)" & cr & "(Text)" & cr & "(Tooltip)" into tXTalkPsuedoFonts
   --- get / sort the fonts listing
   put fontNames("printer") into tFonts
   -- put fontNames() into tFonts
   -- sort lines of tFonts --  by word 1 to 2 of each -- ascending --  international -- by word 1 of each
   sort tFonts ascending international -- by word 1 of each
   -- init variables
   put empty into tFontsArray["fontFamilies"]
   put "" into tPreviousFontFamName
   put "" into tFontStylesList
   put "" into tFontNameStyleReferences
   --- iterate through lines in the Fonts listing
   repeat for each line tCurrentFont in tFonts
      --- skip useless special IDE fonts
      if tCurrentFont is among the lines of tXTalkPsuedoFonts then next repeat
      
      -- iterate through words in current Font name, from right to left
      Repeat with x = the number of words in tCurrentFont to 1 step -1
         --- check for known style keywords, remove from current Font name if found while adding to style string
         if word x of tCurrentFont is among the items of "Plain,Regular,Normal,Condensed,Cond,Compressed,Extended,Extra,ExtraCondensed,Extrabold,Extralight,ExtraLight"&\
               "Extrabold,Book,Italic,Oblique,Med,Medium,Demi,Demibold,Semi,Semibold,SemiBold"&\
               "SemiCondensed,SemiExtended,Bold,Heavy,Black,Light,Ultra,Wide,Utlra,UltraLight,UltraBold,Ultrawide"&\
               "Expanded,Super,SuperLight,Thin,Narrow" then
            -- if word x of tCurrentFont = "Plain" then next repeat
            put word x of tCurrentFont & " " before tFontNameStyleReferences
            delete word x of tCurrentFont
            next repeat
            
            --- if no more known style keywords are found assume the crrent fontname is widdled down to a valid Font family name
         else
            -- if tFontStylesList is empty then put "Plain" into tFontStylesList
            
            -- remove trailing space from Style References   
            if the last char of tFontNameStyleReferences = " " then delete the last char of tFontNameStyleReferences    
            
            -- add any collected FontNameStyleReferences to the family font styles list
            if tFontNameStyleReferences <> empty then
               put tab & tFontNameStyleReferences &cr after tFontStylesList
               put "" into tFontNameStyleReferences
            end if
            
            if tCurrentFont <> tPreviousFontFamName then
               if tCurrentFont is not among the lines of tFontsArray["fontFamilies"] then 
                  if tFontsArray["fontFamilies"] is empty then
                     put tCurrentFont after tFontsArray["fontFamilies"]
                  else
                     put cr & tCurrentFont after tFontsArray["fontFamilies"]
                  end if
               end if
               put tCurrentFont into tPreviousFontFamName
               put "" into tFontNameStyleReferences
               put  empty into tFontStylesList
            end if 
         end if
      end Repeat
      filter lines of tFontStylesList without empty
      sort lines of tFontStylesList
      
      if tCurrentFont = tPreviousFontFamName and tFontStylesList <> empty then
         if tFontsArray[tCurrentFont] is empty then
            put tFontStylesList after tFontsArray[tCurrentFont]
         else
            put cr & tFontStylesList after tFontsArray[tCurrentFont]
         end if
         put "" into tFontStylesList
         put tCurrentFont into tPreviousFontFamName
         next repeat
      else if tCurrentFont <> tPreviousFontFamName and tFontStylesList = empty then
         if tCurrentFont is not among the lines of tFontsArray["fontFamilies"] then put cr & tCurrentFont after tFontsArray["fontFamilies"]
         put tCurrentFont into tPreviousFontFamName
      else
         put tCurrentFont into tPreviousFontFamName
      end if
   end repeat
   
   --- generate Fontlist from tFontsArray
   repeat for each line tFontFam in tFontsArray["fontFamilies"]
      -- Add font Family Name to list
      put cr & tFontFam & cr after tFontsList
      -- if there are any fontStyles then add the fontStyles sub-menu 
      if tFontsArray[tFontFam] is not empty then
         --- if there isn't onee we need to add a way to select the no-style version of the font to the fontStyles sub-menu
         if "Plain" is in tFontsArray[tFontFam] or  "Regular" is in tFontsArray[tFontFam] then
            put cr & tFontsArray[tFontFam] after tFontsList
         else
            put cr & tab & "\(Plain\)" & cr & tFontsArray[tFontFam] after tFontsList
         end if
      end if
   end repeat
   filter lines of tFontsList without empty
   return tFontsList 
end fontMenu


Re: fontMenu function with submenus

Posted: Fri Aug 09, 2024 5:59 pm
by OpenXTalkPaul
Slightly more interesting Demo Stack with Button creates a snapshot to PNG imageText from the 'Test Text' feild
fontMenu-PM.oxtstack
(28.6 KiB) Downloaded 100 times
Screen Shot 2024-08-09 at 1.55.53 PM.png
Screen Shot 2024-08-09 at 1.55.53 PM.png (140.85 KiB) Viewed 5876 times
Font was probably used by the late 80s metal band 'TESTament', sorry :lol:

Re: fontMenu function with submenus

Posted: Fri Aug 09, 2024 6:21 pm
by OpenXTalkPaul
This looks like it might be easy to wrap with XB FFI for using the System's fontPicker on macOS:
https://developer.apple.com/documentati ... guage=objc

I've already wrapped some NSFont stuff before:
https://github.com/PaulMcClernan/OpenXT ... Font-Tools

That returns a URI list with Postscript Printer FontNames attached and including all Fonts within a font collection file (.TTC file format), and also includes special (normally hidden) Apple System font files like so:

Code: Select all

file:///System/Library/Fonts/Keyboard.ttf#postscript-name=.Keyboard
file:///System/Library/Fonts/Kohinoor.ttc#postscript-name=KohinoorDevanagari-Bold
file:///System/Library/Fonts/Kohinoor.ttc#postscript-name=KohinoorDevanagari-Light
file:///System/Library/Fonts/Kohinoor.ttc#postscript-name=KohinoorDevanagari-Medium
file:///System/Library/Fonts/Kohinoor.ttc#postscript-name=KohinoorDevanagari-Regular
file:///System/Library/Fonts/Kohinoor.ttc#postscript-name=KohinoorDevanagari-Semibold

Re: fontMenu function with submenus

Posted: Fri Aug 09, 2024 7:10 pm
by OpenXTalkPaul
Of course I could get some AI assist on wrapping NSFontPanel

Code: Select all

------- eXtension Builder bindings strings for Apple's NSFontPanel----------
-- To create LiveCode Builder (LCB) binding strings for Apple's NSFontPanel, you would need to bind to the Objective-C methods provided by NSFontPanel.  Below are some examples of how you might define foreign handler bindings for various NSFontPanel methods.

-- Allocating and Initializing NSFontPanel:
private foreign handler ObjC_NSFontPanelAlloc() returns ObjcId binds to "objc:NSFontPanel.alloc"
private foreign handler ObjC_NSFontPanelInit(in pFontPanel as ObjcId) returns ObjcId binds to "objc:NSFontPanel.-init"

-- Getting the Shared NSFontPanel Instance:
private foreign handler ObjC_NSFontPanelSharedFontPanel() returns ObjcId binds to "objc:NSFontPanel.+sharedFontPanel"

-- Making the NSFontPanel Visible:
private foreign handler ObjC_NSFontPanelOrderFront(in pFontPanel as ObjcId) binds to "objc:NSFontPanel.-orderFront:"

-- Setting the Font Panel Delegate:
private foreign handler ObjC_NSFontPanelSetDelegate(in pFontPanel as ObjcId, in pDelegate as ObjcId) binds to "objc:NSFontPanel.-setDelegate:"

-- Running the Font Panel Modal Loop:
private foreign handler ObjC_NSFontPanelRunModal(in pFontPanel as ObjcId) returns Int binds to "objc:NSFontPanel.-runModal"

-- Getting the Selected Font:
private foreign handler ObjC_NSFontPanelSelectedFont(in pFontPanel as ObjcId) returns ObjcId binds to "objc:NSFontPanel.-panelConvertFont:"

Setting the Selected Font:
private foreign handler ObjC_NSFontPanelSetPanelFont(in pFontPanel as ObjcId, in pFont as ObjcId, in pIsMultiple as Bool) binds to "objc:NSFontPanel.-setPanelFont:isMultiple:"

-- Here is an example of how you might use these bindings to create and display an NSFontPanel in a LiveCode Builder script:


public handler ShowFontPanel()
   variable tFontPanel as ObjcId
   variable tSelectedFont as ObjcId

   -- Get the shared NSFontPanel instance
   put ObjC_NSFontPanelSharedFontPanel() into tFontPanel

   -- Order the font panel to the front (make it visible)
   ObjC_NSFontPanelOrderFront(tFontPanel)

   -- Get the currently selected font
   put ObjC_NSFontPanelSelectedFont(tFontPanel) into tSelectedFont

   -- Do something with the selected font, e.g. return font name as a text string
end handler

-- Important Notes: The NSFontPanel is a part of the macOS AppKit framework, and thus these bindings will only be applicable on macOS.
-- NSFontPanel interacts closely with the macOS UI and requires proper setup for delegates, window management, and event handling.
-- It’s crucial to test these bindings in your specific use case to ensure they behave as expected.
That looks like a pretty good start, it even names ObjC_ binding handler names the way I normally do (probably because it's already consumed my GitHub repos ;-) )

Re: fontMenu function with submenus

Posted: Fri Aug 09, 2024 9:08 pm
by OpenXTalkPaul
Of course the NSFont stuff could only be used on Apple platforms (might also work also on Linux & Windows if using the GNUStep libraries, which I suppose could be wrapped with XB FFI as well).

So I'm also currently looking at FontConfig (FFI + shared library, or cli) and libFreeType (which is already an Engine dependency), which are both available for all three Desktop platforms (and more), (macOS build formula at HomeBrew: https://formulae.brew.sh/formula/fontconfig)

The two libraries have different problems they're trying to solve.

– FreeType can load / unload fonts into memory, and extract a lot of finer bits information from a font, get lists of used unicode ranges in a font, extract individual characters glyphs, etc.
http://freetype.org/freetype2/docs/reference/index.html

- FontConfig is like a unified library for cataloging and listing font resources available on the system, and allows for grouping fonts into font sets, which I was thinking it would be great if we could have that for OXT font menus too. Imagine having a font menu submenu that's 'CSS WebSafe Fonts' or 'My Big Client's Custom Fonts' (I know for a fact that some big companies like 'Oppenheimer Funds' and AT&T use their own custom made fonts). FontConfig is ubiquitous on GUI Linux distros I believe.
https://fontconfig.pages.freedesktop.or ... -user.html

Re: fontMenu function with submenus

Posted: Sat Aug 10, 2024 6:12 am
by OpenXTalkPaul
OpenXTalkPaul wrote: ↑Fri Aug 09, 2024 7:10 pm Of course I could get some AI assist on wrapping NSFontPanel
That looks like a pretty good start, it even names ObjC_ binding handler names the way I normally do (probably because it's already consumed my GitHub repos ;-) )
Now that I'm able to test that ChatGPT code I take that back, not really a good start because it neglected the NSFontManager object that you need to retrieve in order to pass it to NSFontPanel, once I noticed that mistake it was just a matter of adding another binding and a variable to store the additional object reference, and bingo I get Apple's Font Panel to open, along with all the other stuff like character viewer panel that comes with it!
Screen Shot 2024-08-10 at 1.53.11 AM.jpg
Screen Shot 2024-08-10 at 1.53.11 AM.jpg (195.61 KiB) Viewed 5850 times
Notice how I was able to use character viewer panel to click-to-insert emoji unicode-chars into the message box behind it. Because the Engine has full Unicode support you can actually insert emojis directly into your scripts without using numToCodepoint(num) or any syntax like that. I know Richmond likes those emojis 😎

Here's the corrected code:

Code: Select all

------- eXtension Builder bindings strings for Apple's NSFontPanel----------
-- To create LiveCode Builder (LCB) binding strings for Apple's NSFontPanel, you would need to bind to the Objective-C methods provided by NSFontPanel.  Below are some examples of how you might define foreign handler bindings for various NSFontPanel methods.

-- Getting the Shared NSFontPanel Instance:
private foreign handler ObjC_NSFontPanelSharedFontPanel() returns ObjcId binds to "objc:NSFontPanel.+sharedFontPanel"
-- Get the Shared NSFontManager Instance:
private foreign handler ObjC_NSFontManagerSharedFontManager() returns ObjcId binds to "objc:NSFontManager.+sharedFontManager"
-- Making the NSFontPanel Visible:
private foreign handler ObjC_NSFontPanelOrderFront(in pFontPanel as ObjcId, in pSender as optional ObjcId) returns nothing binds to "objc:NSFontManager.-orderFrontFontPanel:"

-- Setting the Font Panel Delegate:
private foreign handler ObjC_NSFontPanelSetDelegate(in pFontPanel as ObjcId, in pDelegate as ObjcId) returns nothing binds to "objc:NSFontPanel.-setDelegate:"

-- Running the Font Panel Modal Loop:
private foreign handler ObjC_NSFontPanelRunModal(in pFontPanel as ObjcId) returns CUInt binds to "objc:NSFontPanel.-runModal"

-- Getting the Selected Font:
private foreign handler ObjC_NSFontPanelSelectedFont(in pFontPanel as ObjcId) returns ObjcId binds to "objc:NSFontPanel.-panelConvertFont:"

-- Setting the Selected Font:
private foreign handler ObjC_NSFontPanelSetPanelFont(in pFontPanel as ObjcId, in pFont as ObjcId, in pIsMultiple as Bool) returns nothing binds to "objc:NSFontPanel.-setPanelFont:isMultiple:"

-- Here is an example of how you might use these bindings to create and display an NSFontPanel in a LiveCode Builder script:
variable mFontPanel as ObjcId
variable mFontManager as ObjcId

public handler ShowFontPanel() returns nothing
  -- variable mFontPanel as ObjcId
  variable tSelectedFont as ObjcId
  unsafe
     put ObjC_NSFontManagerSharedFontManager() into mFontManager
    --  LogNSObjectClassName(mFontManager)
     -- Get the shared NSFontPanel instance
     put ObjC_NSFontPanelSharedFontPanel() into mFontPanel
    --  LogNSObjectClassName(mFontPanel)
     -- Order the font panel to the front (make it visible)
     ObjC_NSFontPanelOrderFront( mFontManager, mFontPanel )

     -- Get the currently selected font
     -- put ObjC_NSFontPanelSelectedFont(mFontPanel) into tSelectedFont
     -- Do something with the selected font, e.g. return font name as a text string
   end unsafe
end handler
It looks like more than it is because I left in the descriptions / comments from ChatGPT and extra binding strings that I didn't actually use (yet).

Note that the FontPanel may look quite different depending on the macOS version you're running. NSFontPanel dates back to NextStep/OpenStep. NSFontPanel therefore is also included in the GNUStep libraries, which has me thinking again that maybe we should just wrap all of GNUStep libraries and include them as part of the IDE. They are FOSS, it's a complete App/UI toolkit, are still getting updates (release in June) and they work on Linux/Windows providing a bunch of Cocoa compatible APIs.
https://www.slideshare.net/slideshow/cr ... /3431997#6

Re: fontMenu function with submenus

Posted: Sat Aug 17, 2024 4:19 pm
by TerryL
I'm late to the discussion but I wrote a short routine that puts the ten most frequently chosen fonts at the top of the fonts menu. Choosing from the frequent list repositions it on top. It seems to work OK in Win10. It might be a nice addition to a revamped fonts submenu.

Code: Select all

on menuPick pPick  --test frequent fonts list in pulldown menu button "Fonts"
   local tFreqFonts, tLines
   put the cFrequentFonts of me into tFreqFonts  --custom prop, initiate in msg box: set the cFrequentFonts of btn "Fonts" to empty
   put number(lines in tFreqFonts) into tLines
   replace "|" with space in pPick  --reconstruct font full name if submenu
   repeat with i = 1 to tLines
      if pPick = line i of tFreqFonts then  --already in list
         delete line i of tFreqFonts
         put pPick &cr before tFreqFonts  --reposition pPick to top of list
         exit repeat
      else if i = tLines then put pPick &cr before tFreqFonts  --add pPick to top of list, no sort
   end repeat
   if number(lines in tFreqFonts) > "10" then put line 1 to 10 of tFreqFonts into tFreqFonts  --max 10 fonts, discard last oldest font
   set the cFrequentFonts of me to tFreqFonts
   set the text of me to tFreqFonts &cr& "-" &cr& fontNames()  --reload menu
   
   put pPick &cr& number(lines in tFreqFonts)  --display in msg box
end menuPick

Re: fontMenu function with submenus

Posted: Tue Aug 20, 2024 5:18 pm
by TerryL
I improved my previous code using a trick with lineOffset() to replace a repeat loop, increasing speed. Initialize cFrequentFonts with a universal font to prevent a stray blank line on the first selection.

Code: Select all

on menuPick pPick  --test frequent fonts list in pulldown menu button "Fonts"
   local tFreqFonts
   put the cFrequentFonts of me into tFreqFonts  --custom prop, initiate in msg box: set the cFrequentFonts of btn "Fonts" to "Arial"  --universal font
   replace "|" with space in pPick  --reconstruct font full name if submenu
   get lineOffset(cr& pPick &cr, cr& tFreqFonts &cr)  --line # where string = line
   if it <> "0" then delete line it of tFreqFonts  --already in list
   put pPick &cr before tFreqFonts  --add pPick to top of list, no sort
   if number(lines in tFreqFonts) > "10" then put line 1 to 10 of tFreqFonts into tFreqFonts  --max 10 fonts, discard last oldest font
   set the cFrequentFonts of me to tFreqFonts  --update list
   set the text of me to tFreqFonts &cr& "-" &cr& fontNames()  --reload menu
   
   put pPick &cr& number(lines in tFreqFonts)  --display in msg box
end menuPick

Re: fontMenu function with submenus

Posted: Tue Aug 20, 2024 9:00 pm
by OpenXTalkPaul
TerryL wrote: ↑Tue Aug 20, 2024 5:18 pm I improved my previous code using a trick with lineOffset() to replace a repeat loop, increasing speed. Initialize cFrequentFonts with a universal font to prevent a stray blank line on the first selection.

Code: Select all

on menuPick pPick  --test frequent fonts list in pulldown menu button "Fonts"
   local tFreqFonts
   put the cFrequentFonts of me into tFreqFonts  --custom prop, initiate in msg box: set the cFrequentFonts of btn "Fonts" to "Arial"  --universal font
   replace "|" with space in pPick  --reconstruct font full name if submenu
   get lineOffset(cr& pPick &cr, cr& tFreqFonts &cr)  --line # where string = line
   if it <> "0" then delete line it of tFreqFonts  --already in list
   put pPick &cr before tFreqFonts  --add pPick to top of list, no sort
   if number(lines in tFreqFonts) > "10" then put line 1 to 10 of tFreqFonts into tFreqFonts  --max 10 fonts, discard last oldest font
   set the cFrequentFonts of me to tFreqFonts  --update list
   set the text of me to tFreqFonts &cr& "-" &cr& fontNames()  --reload menu
   
   put pPick &cr& number(lines in tFreqFonts)  --display in msg box
end menuPick
Very cool, I think that's a great idea to have a 'Recent Fonts' sub menu!

As I mentioned I'd like to allow for presets like 'Web Safe Fonts' and for user-made Font sets. I don't have any system for that worked out, just some ideas that came to mind while creating the script.

Re: fontMenu function with submenus

Posted: Tue Aug 20, 2024 9:06 pm
by OpenXTalkPaul
TerryL wrote: ↑Tue Aug 20, 2024 5:18 pm Initialize cFrequentFonts with a universal font to prevent a stray blank line on the first selection.
The IDE already comes with the open source font family 'Source Code' as well as a font called 'ide', and the font 'Font Awesome' (an outdated version it) so you could use one of those ( I'm just not sure if those were taken out from OXT Lite so check that first).

Perhaps we could include 'FreeSans' font with the IDE as a default font, then we have font guaranteed to be available on any platform and have consistency in appearance.

Re: fontMenu function with submenus

Posted: Tue Aug 20, 2024 9:52 pm
by FourthWorld
OpenXTalkPaul wrote: ↑Tue Aug 20, 2024 9:06 pm Perhaps we could include 'FreeSans' font with the IDE as a default font, then we have font guaranteed to be available on any platform and have consistency in appearance.
Those who need consistency within their app across platforms more than consistency with the other apps across the platform the user is running probably have more specific typographic needs than a single font can satisfy.

There, just saved you some work. πŸ™‚

Re: fontMenu function with submenus

Posted: Wed Aug 21, 2024 1:25 am
by OpenXTalkPaul
FourthWorld wrote: ↑Tue Aug 20, 2024 9:52 pm
OpenXTalkPaul wrote: ↑Tue Aug 20, 2024 9:06 pm Perhaps we could include 'FreeSans' font with the IDE as a default font, then we have font guaranteed to be available on any platform and have consistency in appearance.
Those who need consistency within their app across platforms more than consistency with the other apps across the platform the user is running probably have more specific typographic needs than a single font can satisfy.

There, just saved you some work. πŸ™‚
That may be true.
But to be clear I meant the entire FreeSans, FreeSerif, FreeMono Family of Fonts, and I was thinking about it because using it would ensure that text labels in the IDE are WYSIWYG are in exact same positions.

And it's would be useful in checking if there is any difference in rendering of the same exact font on different platforms. (of course "Source Code" font family that was already included in the IDE could be used for that).

I don't know, I usually try to make sure there's some extra room in a text box so that there's no unexpected soft line breaks text wrapping due to font metrics. I've never been that critical about Fonts in my stacks, but it sure seems like some people care about their text baselines being in very exact positions. It could also possibly be beneficial in making printed reports be consistent, no matter what platform/device that is sending the pages to the printer. I'm guessing FreeSans doesn't have any sort of Printing restrictions on it (which fonts can have, and it can be a real pain for prepress).

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 9:16 pm
by tperry2x
OpenXTalkPaul wrote: ↑Tue Aug 20, 2024 9:06 pm Perhaps we could include 'FreeSans' font with the IDE as a default font, then we have font guaranteed to be available on any platform and have consistency in appearance.
Yes, I think this would be a better bet than Arial in the stack I'm about to post, as I don't even have Arial on this system (apparently). Even something like "Open Sans" which is what this forum is rendering in.
perhaps.png
perhaps.png (43.29 KiB) Viewed 4217 times
TerryL wrote: ↑Tue Aug 27, 2024 5:23 pm ...back on topic,
@ tperry. What do you think of applying the Frequent Fonts idea to OXT Lite, even without font submenus?
viewtopic.php?p=10482#p10482
I like those examples a lot, however - hope you don't mind - I've modified it slightly so that it won't re-add it's frequent font at the top of the menu if one of the first 10 frequent fonts are re-chosen by the user. It also updates on each click. I suggest we replace Arial with something else, as this is a minimal distro I'm typing this on, and I don't even have Arial, so I like Paul's idea of adding a "Fully Open Source" font to the IDE. I'd also like a fixed width one which would be a good choice for the script editor to look the same between all platforms too.

(as an option, of course)
another-method-perhaps.png
another-method-perhaps.png (11.93 KiB) Viewed 4235 times
font menus.oxtstack
(10.15 KiB) Downloaded 81 times
Edit: Testing on a different computer (one with Arial added)
different-computer.png
different-computer.png (59.05 KiB) Viewed 4175 times
The only thing this doesn't do is clear up the most recent 10 fonts from the top of that menu if one isn't available anymore, so I'll add that in at some point too.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:02 pm
by OpenXTalkPaul
I'd also like a fixed width one which would be a good choice for the script editor to look the same between all platforms too.
It already comes with Source Code Pro doesn't it? Or did I add that?
I know LC Community came with the normal Font version of 'Font Awesome' and another custom font called 'lcide.ttf', neither of which are actually used anywhere in the IDE as far as I can tell.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:05 pm
by tperry2x
Oh yeah, you are right. There's a whole load of them:
oh-yeah.png
oh-yeah.png (46.39 KiB) Viewed 4212 times
That's cool then. I'll edit my stack linked above to use that font instead of Arial.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:12 pm
by OpenXTalkPaul
tperry2x wrote: ↑Tue Aug 27, 2024 10:05 pm That's cool then. I'll edit my stack linked above to use that font instead of Arial.
You beat me to it:
https://github.com/OpenXTalk-org/OpenXt ... iles/fonts
Being able to point to parts of the IDE, or lines of code in one of it's libraries via URL is another nice thing about using GitHub (but no you can't download a sub-directory so that's a mark against).

I'm not sure if that font includes a 'monospace' font version, which would be strange for a font with that name.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:14 pm
by tperry2x
Seems like none of those actually get loaded by the IDE though. Perhaps the fontAwesome does as it's used in the tool header icons? - but can't find any mention of it anywhere else, like you say. That's a bit weird.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:16 pm
by tperry2x
OpenXTalkPaul wrote: ↑Tue Aug 27, 2024 10:12 pm Being able to point to parts of the IDE, or lines of code in one of it's libraries via URL is another nice thing about using GitHub (but no you can't download a sub-directory so that's a mark against).
I almost don't want to mention it ever again, but there's also that file size limitation through a browser (25MB), which I'd hit if I were to try uploading the allguides stack. That's another deal breaker, and I'm not about to pay for it :shock:

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:17 pm
by tperry2x
As I mentioned briefly, I'd point any new users to OXT towards your build Paul, rather than Lite. Particularly if they expect to use Github.

Re: fontMenu function with submenus

Posted: Tue Aug 27, 2024 10:24 pm
by tperry2x
That's interesting. The IDE is obviously looking for that, as soon as I activated it and set a field to it, the script editor and message box start using it:
missing.png
missing.png (35.89 KiB) Viewed 4200 times