topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 9:59 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Can CSS apply custom user style to a certain range of Unicode characters?  (Read 6531 times)

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Is there a way in CSS to have a selector for all text with a Unicode range of say, 0900–097F? (Assume the HTML does use any language tags.)

Trying to see if this problem can be resolved using Stylish and a custom userstyle for Unicode characters in that range.

Yesterday I discovered the Siddhanta font for displaying Devanagari. Today I discovered that most of the Devanagari on the web is in Arial, Helvetica, or sans-serif font, even in things like Devanagari conjunct tables, where it makes no sense. Why would they not use at least Mangal? Since it is easy enough for web designers to specify a list of display fonts in order of preference, what are they thinking? Are they so grateful we have Unicode these days, they just don't care what font it is in?

Any idea why on earth would that be, and how do I shoehorn in alternative fonts generally? The closest thing I've come up with is the FontFinder extension for Firefox, but that will only let you change the font one character or word at a time or the whole web page, and you have to do it manually after the page loads.
-daddydave
« Last Edit: December 16, 2011, 10:40 PM by daddydave »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
My first thought is that it's way beyond CSS.

More of a javascript thing perhaps?

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Sounds like something that could be done with a simple enough custom Javascript bookmarklet. I don't do much JS myself, but could be worth asking in coding snacks section.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
My first thought is that it's way beyond CSS.

More of a javascript thing perhaps?

I think so probably, but then I saw selectors that could apply to text tagged for specific languages, and thought this might be possible, too. Yeah, probably a Greasemonkey script could do it. It may not matter much, I think some of the ligatures/conjuncts are used more for Sanskrit than Hindi which I am learning, so I don't want to get too confused with alternate forms.

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
It's not CSS, but the solution to the real problem turned out to be hidden in plain sight; see my update to my Unilang thread. Now I am just looking for some kind of browser addon to change this setting back and forth with one or two clicks.

I am taking it that Devanagari in that dropdown refers to the Unicode range itself, since there does not seems to be any language tags or markup that indicates it is Hindi or Devanagari text, and it works.
« Last Edit: December 28, 2011, 07:07 PM by daddydave »

daddydave

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 867
  • test
    • View Profile
    • Donate to Member
Got it done with PrefBar! And it is definitely a geek tool. Still fine tuning it because I actually want to change 2-3 settings at the same time, but this works so great I made an animated gif of my custom preference in action (used the ScreenshotCaptor Grab Repeat Last Size+Pos feature for the first time):

s1-4.gif



« Last Edit: December 28, 2011, 07:08 PM by daddydave »