Comments (7)
Hey!
Of cause it's possible! You can change font as usual (applying it for a TextView directly)
from markwon.
@noties hey. What i do wrong ?
I create TextView, render markdown to it Markwon.setMarkdown(textView,markdownStr);
,
create typeface from asset Typeface typeface = Typeface.createFromAsset(context.getAssets(), "myfont.ttf");
and apply it textView.setTypeface(typeface);
, but typeface don't changes.
from markwon.
Most likely there is some issue with loading your custom typeface.
- make sure that your custom typeface file is located in root of assets (not
raw
) folder (it can be in a nested folder, but then you have to specify it like:Typeface.createFromAsset(getAssets(), "fonts/myfont.ttf"
) - make sure that you have specified file name correctly
- make sure that it's valid typeface (maybe it's corrupted or something)
I have just checked setting custom typeface in the sample application and it works as expected (Noto Serif
):
from markwon.
@noties can you show the code of sample ? Because Typeface.createFromAsset(context.getAssets(), "myfont.ttf");
works normal and return work typeface, i use him in config SpannableTheme.builder().codeTypeface(typeface)
to MarkwonView
, and in MarkwonView
some parts of text renders with this font. But only some parts.
from markwon.
Oh... this is problem in my code. Typeface is not setting in TextView. Sorry, its my problem. Thx, super library.
from markwon.
Is it possible to add different custom fonts depending on which type you are?
For example.
Header - Use Font Gelica
Regular - Use Font Helvetica
from markwon.
Alright, I've figure it out. It's actually using AbstractMarkwonPlugin.configureTheme
to set the headingTypeface
.
Then, I just use the conventional TextField.style
from Android SDK to set it for the rest.
Not ideal, but workable.
val markwon = Markwon.builder(requireContext())
.usePlugin(object : AbstractMarkwonPlugin() {
override fun configureTheme(builder: MarkwonTheme.Builder) {
val gelicaTypeface = ResourcesCompat.getFont(requireContext(), R.font.gelica_regular)
val maisonTypeface = ResourcesCompat.getFont(requireContext(), R.font.maison_neue)
builder.headingTypeface(gelicaTypeface)
}
}).build()
from markwon.
Related Issues (20)
- How to break apart markdown so accessibility services can focus on each individual heading HOT 1
- How to implement search in tables ? HOT 1
- Can Markwon support line spacing? HOT 1
- Can't load svg HOT 2
- Help with syntax HighLight using Prism4j HOT 1
- MarkwonInlineParserPlugin is not thread-safe HOT 1
- svg file assets are not full width HOT 5
- Support for html tags <detail> & <summary> for collapsible content HOT 1
- TaskList item highlight doesn't toggle even after the checkbox gets toggled back to not done HOT 2
- Table not rendred at all
- Cant load svg HOT 2
- Remove mark from text HOT 1
- Change error drawable size HOT 1
- Markwon jetpack compose HOT 1
- How to add additional new line for `<p>` html tag to behave same as Android's Html class.
- ImagesPlugin doesn't render images inside tables
- SpannableStringBuilderReversed issue
- How do you split into multiple spans? HOT 1
- Fontawesome svg not loaded
- io.noties.markwon:syntax-highlight:4.6.2 gradle iserror HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markwon.