How do we increase the code font size
MShamshuddeen opened this issue · comments
Hi! Try this one.
i didn't understand can you more elaborate on that.Where i need to pass the fontSize @kbiakov
codeView.setOptions(Options.Default.get(this)
.withLanguage("python")
.withCode(R.string.code5)
.withTheme(ColorTheme.MONOKAI)
.withFormat(Format.Compact.copy(fontSize=15f)));
after adding this m getting error
Error:(24, 35) error: Compact has private access in Format
Error:(24, 49) error: cannot find symbol variable fontSize
If you use it from Java, you should create the instance of Format
class and provide several params:
codeView.setOptions(Options.Default.get(this)
.withLanguage("python")
.withCode(R.string.code5)
.withTheme(ColorTheme.MONOKAI)
.withFormat(new Format(
1, // scale factor
18, // line height
3, // border height
15 // font size
));
It's a good catch! At this moment it is not so simple and convenient to create format this way in cause of interoperability with Kotlin data classes which represents Format
. I will improve Java support in next release.
P.S. The preceding constants was taken from Format.Compact
.
@MShamshuddeen @Rizwansyed9 That helped? Can I close the issue?
Yes, Thanks for your Time and support
So, i have added a button to zoom in,
but here is what happens on zooming in :
zoomIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
zoom++; //a variable to keep track of current zoom level
mCodeView.setOptions(Options.Default.get(HomeActivity.this)
.withLanguage("c")
.withCode(currentCode)
.withFont(Font.Consolas)
.withFormat(new Format(
1, // scale factor
(zoom+(int)(zoom*0.30)), // line height
3, // border height
zoom // font size
))
.withTheme(ColorTheme.MONOKAI));
}
});
but this refreshes the code, can't i just change the format without re-initializing the whole code in the code view ? is that possible ?