diff --git a/src/plugins/lua/bindings/texteditor.cpp b/src/plugins/lua/bindings/texteditor.cpp index 0a28984a199..a774f1d6cbf 100644 --- a/src/plugins/lua/bindings/texteditor.cpp +++ b/src/plugins/lua/bindings/texteditor.cpp @@ -353,6 +353,11 @@ void setupTextEditorModule() QTC_ASSERT(document, throw sol::error("TextDocument is not valid")); return document->filePath(); }, + "font", + [](const TextDocumentPtr &document) { + QTC_ASSERT(document, throw sol::error("TextDocument is not valid")); + return document->fontSettings().font(); + }, "blockAndColumn", [](const TextDocumentPtr &document, int position) -> std::optional> { QTC_ASSERT(document, throw sol::error("TextDocument is not valid")); diff --git a/src/plugins/lua/meta/texteditor.lua b/src/plugins/lua/meta/texteditor.lua index fa63c0880cd..cb62a6e473d 100644 --- a/src/plugins/lua/meta/texteditor.lua +++ b/src/plugins/lua/meta/texteditor.lua @@ -78,6 +78,10 @@ local TextDocument = {} ---@return FilePath filePath The file path of the document. function TextDocument:file() end +---Returns the font of the document. +---@return QFont +function TextDocument:font() end + ---Returns the block (line) and column for the given position. ---@param position integer The position to convert. ---@return integer block The block (line) of the position.