Ok, I have tried a lot of combinations and ended up with this one "semi"-working. Before writing the setItalic if I write the SetFont for that style it will work in most cases, something like this:
StyleSetFont(SCE_LUA_COMMENTLINE, 'Courier New');
StyleSetSize(SCE_LUA_COMMENTLINE,10);
StyleSetItalic(SCE_LUA_COMMENTLINE,true); // "--..."
So now the ONLY problem would be keywords and variable names (in purple in the picture)
@Edited: here is how it looks like now:
and here is the code I used:
with EditScript do
begin
SetScrollWidth(430); //so we don't see it
Margins.Right:=1;
Margins.Left:=0;
Margins.Top:=0;
Margins.Bottom:=0;
SetMarginLeft(5);
SetMarginWidthN(0,40);
SetMarginWidthN(1,0);
SetExtraAscent(4); //space between lines
//-----------------------margin line numbers
StyleSetFont(STYLE_LINENUMBER, 'Default');
StyleSetBold(STYLE_LINENUMBER, true);
StyleSetBack(STYLE_LINENUMBER, gray);
StyleSetFore(STYLE_LINENUMBER,clWebBlack);
//-----------------------Text
SetLexerLanguage('Lua'); //don't work
SetLexer(SCLEX_LUA);
SetCodePage(CP_UTF8);
StyleSetFont(SCE_LUA_DEFAULT, 'Courier New');
StyleSetSize(SCE_LUA_DEFAULT,10);
StyleSetFont(SCE_LUA_IDENTIFIER, 'Courier New');
StyleSetSize(SCE_LUA_IDENTIFIER,10);
StyleSetFont(SCE_LUA_COMMENTLINE, 'Courier New');
StyleSetSize(SCE_LUA_COMMENTLINE,10);
StyleSetFont(SCE_LUA_WORD, 'Courier New');
StyleSetSize(SCE_LUA_WORD,10);
StyleSetFont(SCE_LUA_LITERALSTRING, 'Courier New');
StyleSetSize(SCE_LUA_LITERALSTRING,10);
StyleSetFont(SCE_LUA_COMMENTDOC, 'Courier New');
//-----------------------Italics
StyleSetItalic(SCE_LUA_COMMENTLINE,true); // "--..."
StyleSetItalic(SCE_LUA_LITERALSTRING,true); // "[[...]]"
StyleSetItalic(SCE_LUA_IDENTIFIER,true); // "variables"
StyleSetBold(SCE_LUA_IDENTIFIER,true);
StyleSetBold(SCE_LUA_WORD,true); //init start/end true false
StyleSetItalic(SCE_LUA_COMMENTDOC,true); //don't work
//-----------------------KeyWords
SetKeyWords(0, 'if then else init start end true false');
//-----------------------Colours
StyleSetFore(SCE_LUA_COMMENTLINE, green_comments);
StyleSetFore(SCE_LUA_COMMENTDOC, green_comments);
StyleSetFore(SCE_LUA_NUMBER, blue_numbers);
StyleSetFore(SCE_LUA_CHARACTER, red_strings);
StyleSetFore(SCE_LUA_OPERATOR, green_conditionals);
StyleSetFore(SCE_LUA_LITERALSTRING, green_comments);
StyleSetFore(SCE_LUA_IDENTIFIER, purple);
StyleSetFore(SCE_LUA_WORD, blue_strings);
end;