Calligraphy icon indicating copy to clipboard operation
Calligraphy copied to clipboard

Is it possible to add an attribute to disable Calligraphy on a TextView?

Open squeeish opened this issue 9 years ago • 20 comments

I'm required to have custom fonts app-wide while using https://github.com/JoanZapata/android-iconify.

However, android-iconify does not work with Calligraphy.

Is there a workaround? Can I do something like this?

<IconTextView
    android:text="{fa-heart}"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:disable_calligraphy="true"
    />

squeeish avatar Mar 29 '15 19:03 squeeish

Thats a good idea. What would be prefered a attribute or a ignoreClass(Class<?> clazz) in the builder?

chrisjenx avatar Mar 30 '15 11:03 chrisjenx

Right now an attribute will be great because it would fit my needs perfectly. Let me see if I can contribute by looking at the code.

squeeish avatar Mar 30 '15 16:03 squeeish

Well in the interim I've found that using Iconify.addIcons(yourTextView) works for me. Leaving this here for future reference.

Meanwhile I'll submit a pull request soon for the new attribute.

squeeish avatar Apr 09 '15 05:04 squeeish

How would this play out with menuitems, which don't give access to the underlying TextViews? Or are you somehow building out menus using IconTextViews?

rothschild86 avatar Jun 22 '15 20:06 rothschild86

I don't think the menu items get any font applied as they are pragmatically created by Android.

On Mon, 22 Jun 2015 21:14 rothschild86 [email protected] wrote:

How would this play out with menuitems, which don't give access to the underlying TextViews? Or are you somehow building out menus using IconTextViews?

— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/152#issuecomment-114246934 .

chrisjenx avatar Jun 22 '15 20:06 chrisjenx

@chrisjenx do you have caligraphy and android-iconify running together in you project?

rothschild86 avatar Jun 22 '15 20:06 rothschild86

No, never used iconify.

On Mon, 22 Jun 2015 21:18 rothschild86 [email protected] wrote:

@chrisjenx https://github.com/chrisjenx do you have caligraphy and android-iconify running together in you project?

— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/152#issuecomment-114249165 .

chrisjenx avatar Jun 22 '15 20:06 chrisjenx

@chrisjenx thanks for a great library

Just faced the same issue and in my opinion it should be an ignoreClass since you don't want to write attribute in every single place where you use iconify in a layout. Created #189

Malinskiy avatar Jul 13 '15 12:07 Malinskiy

Why not both options? An attribute and an ignoreClass in the builder? Either can be helpful.

kashban avatar Jul 13 '15 12:07 kashban

OK, seen as more than one person wants this I'll add it as a feature request.

On Mon, 13 Jul 2015 13:38 kashban [email protected] wrote:

Why not both options? An attribute and an ignoreClass in the builder? Either can be helpful.

— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/152#issuecomment-120913772 .

chrisjenx avatar Jul 13 '15 13:07 chrisjenx

@kashban on the other hand maybe there is some scenario where this could be of use. Initially I only fixed this for Iconify. Pushed additional changes to pull request with calligraphyIgnore attribute

Malinskiy avatar Jul 13 '15 13:07 Malinskiy

@rothschild86 I think until this gets implemented, another way to get both library to work well together would be to update your iconify library to use the v2 that has been released recently. Its author says it now works with Calligraphy. You can have a look at the new features here: http://blog.joanzapata.com/iconify-just-got-a-lot-better/

ghost avatar Sep 11 '15 08:09 ghost

Cool nice work. Just remember, there are spans used in certain places (Action Bar) still. Apart from that looks like a nice overhaul.

On Fri, 11 Sep 2015 09:32 k3v1n4ud3 [email protected] wrote:

@rothschild86 https://github.com/rothschild86 I think until this gets implemented, another way to get both library to work well together would be to update your iconify library to use the v2 that has been released recently. Its author says it now works with Calligraphy. You can have a look at the new features here: http://blog.joanzapata.com/iconify-just-got-a-lot-better/

— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/152#issuecomment-139485268 .

chrisjenx avatar Sep 11 '15 08:09 chrisjenx

@k3v1n4ud3 right on! switched to iconics, which also plays nicely with caligraphy.

rothschild86 avatar Sep 11 '15 16:09 rothschild86

I'd still wish to see a disable option. I'm currently using a default font on the default textAppearance. But my font doesn't look good with numbers, so I'd like to disable it for a specific price TextView. Is this still on the roadmap?

kevinvanmierlo avatar Jul 01 '16 14:07 kevinvanmierlo

Pinging on this one since it's been 6 months... - Is this still a consideration

njwandroid avatar Dec 20 '16 23:12 njwandroid

No. If it doesn't do it anyway, I'll change it so that fontPath="@null" would set the font to system default.

chrisjenx avatar Dec 20 '16 23:12 chrisjenx

@chrisjenx Good idea; I actually had just tried that and it didn't work, so if you end up doing that please let me know. (PS sorry for duplicate issues)... I'll do that though, I'll just ship the fonts myself for now...

<style name="MyNotoSerifHeader">
    <item name="android:textSize">30sp</item>
    <item name="android:textColor">@color/text_black</item>
    <item name="android:fontFamily">serif</item> <!-- Noto serif, introduced in lollipop -->
    <item name="fontPath">@null</item>
</style>

njwandroid avatar Dec 20 '16 23:12 njwandroid

Thx for letting me know.

On Wed, 21 Dec 2016, 00:45 Neil Jay Warner, [email protected] wrote:

@chrisjenx https://github.com/chrisjenx Good idea; I just tried that and it didn't work, so if you end up doing that please let me know. (PS sorry for duplicate issues)... I'll do that though, I'll just ship the fonts myself for now...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/152#issuecomment-268392264, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHRsRJKxLO1ZA5kIM8sd46xm5PvR1kDks5rKGiMgaJpZM4D2tRB .

chrisjenx avatar Dec 20 '16 23:12 chrisjenx

Hi! Great and useful library, thanks!

I'm trying -as others as I can see in this thread- to disable default callygraphy font on specific Textfields to show the system serif default font.

My Activity has lots of Textfield & fragments using the default callygraphy font, so it's not a good idea to remove that.

I've tried with this fontPath="@null" (Without @ as well) parameter on the Textfield but it doesn't work for me. There is another workaround or way to achieve that?

Here is the code: `

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_vertical|left"
                        android:paddingLeft="20dp"
                        android:text="@string/filter_title_vip"
                        fontPath="@null"
                        android:fontFamily="sans-serif"
                        android:textColor="@color/text_color_dark_blue"
                        android:textSize="15sp"
                        android:letterSpacing="0.06"
                        android:textAllCaps="true"
                        />`

Thanks in advance

oriolmanya avatar Jun 20 '17 10:06 oriolmanya