How would I specify a condensed or narrow font for a DropDown?

That is, using the standard Anvil-provided DropDown properties?

Does this work for you:

edit:

Actually, just typing Open Sans Condensed directly into the font property worked for me without any additional css.


the following is (possibly) not needed

/* In theme.css */
@import url('https://fonts.googleapis.com/css?family=Open+Sans+Condensed&display=swap');

.anvil-role-drop_font {
  font-family: "Open Sans Condensed", sans-serif;
}

You would need to create a custom role for your drop down component.

sc2

I realize that this is not a standard Anvil-provided property for drop downs.

1 Like

I think I still need the @import…

Interesting. Here is a clone that I’m using. I don’t belive it has an @import in the theme.css as far as I can see. I could be missing something. Possibly browser differences.

https://anvil.works/build#clone:UGLE5VPHISSVQRER=UAC4TFSL24GLYKBSBVLIVGMG

Thanks, Alan. In my browser, entering Open Sans Condensed gets me a slightly smaller serif font. Definitely not a sans-serif, and definitely not condensed.

I see. Okay, perhpas the ā€œroleā€ and @import route will help to force things.

I pasted that at the end of my app’s theme.css, but it made no difference.

Ah, but did not create the Role… stand by… no luck.

Not a huge deal. I’ll dig into Roles and theme.css some other time. If I find an easy solution, I’ll post it here.

Thanks for your efforts.

Try placing the CSS and import at the top of your theme.css. In my testing, it needed to be at the top.

Or just clone this to see if it works.
https://anvil.works/build#clone:UGLE5VPHISSVQRER=UAC4TFSL24GLYKBSBVLIVGMG

I’ve cloned it, thanks. Same result. Even pasted Open Sans Condensed into the font field. Puzzling.

I’m using Chrome Version 79.0.3945.130 under Windows 10, but I doubt that has anything to do with it.

I’m at a loss. How odd.

I did the following to @alcampopiano clone and it worked for me

in standard.html you can see the line where anvil link to the google font so do the same thing:

<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300&display=swap" rel="stylesheet">

then remove the @imports from theme.css which isn’t necessary with this method…

2 Likes

Thanks Stu. I knew you could help!

I was drawing from the custom font tutorial.

I’m unsure why it works for me but not others.

:man_shrugging: not sure

@stucork, I’ve tried it. Works for the clone, but not for my app.

For now, I’m just setting my font size a little smaller. I have other ways to deal with the page layout. It’s not critical.

Oh no :man_facepalming:. When you get a moment you should share a clone link that doesn’t work… we’ll fix it :wrench:

1 Like

:construction_worker_man:

(actually, I’m fairly certain the fix is beyond my understanding)

Cloning our 2.5-year-old app with over 1MiB of proprietary code, and substantial data, to demonstrate a minor issue like this, is probably not in the cards.

If I can find a way to quickly reproduce it in something small, then I can clone that for you. And if our priority on this issue goes up enough, I’ll attempt it.

2 Likes