Get user's script font size?

I’m trying to access the script editor’s font size. Is this possible?

The only way I can see currently is this:

settings().Studio.Font

But that throws an error: Unable to get property Font, type QFont. So is there another way to do this? Or some secret way to use QFont that I’m not aware of?

As far as I’m aware, it’s impossible to do anything with QFont or QDir as it’s used internally. There might be a hacky solution to get the script editor font size, but nothing straightforward.

But what you’re working on sounds intriguing, so please tell us more about it and maybe we can find a suitable alternative together :wink:

1 Like

I’m revamping my code previewer for my framework’s plugin. Implementing syntax highlighting:

The code show in the image is in the default script editor, right? How did you change the title?

A couple years ago I started working on an in game script editor for an interactive Lua tutorial. Unfortunately I left it in a state where the progress on the editor isn’t visible and I can’t quite remember how to use it again. :stuck_out_tongue: Back then there wasn’t some of the minimal IDE features that studio has now, so I also wanted to try and add suggestions and similar things. If I remember correctly, I got syntax highlighting and code collapsing working. There may have been some editing bugs.

Point being: if you feel so inclined, you can make your own script editor. If you do, please make it an open source community project so we can all help you and make it great. For the past 16 or so hours I’m been working on my typed lua project called LuaFida (fida being Latin for trustworthy). I have a flexible deterministic finite automata tokenizer and am currently working on a LL(k) parser generator, all in Lua. Having an interface to allow for custom highlighting and other interactions rather than a command-line style error list would be great.

The editor, unfortunately as is the case with a lot of Roblox features, is all implemented in C++ in a way that we can’t interface with. While I was an intern I went out of my way to push (as I am now) that most functionality should be implemented in Lua. The API exposed to Lua should be the core basic functionality (i.e. draw a triangle/image). All of the GUI objects like TextBox and ImageButton should be created in Lua on top of the core functionality and editable. This would work well with the soon to be released package system. Basically I have a vision of Roblox similar to Linux, with almost everything being swap-able with custom functionality.

Obviously not everyone thought we should trash all the legacy C++ codebase. :stuck_out_tongue: One common argument was that Lua would be too slow. We talked about LuaJIT, but only JS can be JIT’d on Apple devices so we thought about transpiling Lua to JS. But now what I think would be best is writing a front end for GCC for Lua. That way Roblox games can be approved, installed, and run like any other game on Apple devices, the Roblox app being a like a normal app catalog. Server scripts could also be compiled for HUGE speed ups across all Roblox games.

I loved the step we took toward this vision with Lua Widgets. So, if you want to support this vision for Roblox, making open source community projects in the form of packages/repositories, like a code editor, is a great start. I’d suspect that LuaFida will start being useful sometime next week. Who knows? If the community makes it great enough, maybe it will become THE Roblox script editor some day. ^.^

2 Likes

FWIW, I’m using Penlight’s lexer module to tokenize code. From there, it was super easy to turn it into a series of TextLabels, using the token title as a key for the correct color using the studio theme API. So the core functionality is pretty approachable and open-sourced for anyone already!

My widget in the picture is pretty rudimentary. It will display the code and let you scroll through it, but you can’t interact with it. Trying to create my own editor would take ages, and there’s a lot of finicky use-cases when making a text editor (I tried to make one many years ago–it was fun but stressful).

Ahh, I’ve found it. Hmmm, using a DFA lexer the state could be saved at the start of each token, allowing very quick re-lexing while editing. I’ll have to take a closer look at it here in a couple days. Is the plugin code all inside the plugin/*.rbxmx file?

1 Like

Yup, and I also keep a copy of it on my GitHub page for the framework

Too my knowledge it’s not possible to get the user’s font size. The best thing you could do is to allow them to change it themselves in some form of settings menu for your plugin.