Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop iOS from converting a small pointing right triangle character into a rectangluar boxed triangle symbol?

Tags:

ios

unicode

enter image description here I've tried entering the small pointing right triangle and the right arrow characters, both are converted by iOS into rectangular icons with a right triangle and a right arrow, respectively. Can I declare a different font to stop this from happening? Or is there a default setting I need to turn off?

All a want is a black small pointing right triangle:

Decimal Hex
▸ 9656 ▸ 25B8

Here is the Code:

NSString *title = [NSString  stringWithFormat:@"%d payments of %@ ➡ ▶", duration, [Utils formatPrice:payment]];
   [button setTitle: title forState: UIControlStateNormal];

Any suggestions would be appreciated.

like image 260
MyopicVisage Avatar asked Jun 24 '12 14:06

MyopicVisage


3 Answers

This is not about changing font, but about unicode variation. On Unicode 6.1, one unicode code point can have multiple glyphs, and you can choose those using Variation Selectors.

For about emoji, you can use U+FE0E(@"\U0000FE0E") to choose text style graph. (And, U+FE0F(@"\U0000FE0F") is for Apple Color Emoji).

For example, LEFT-POINTING TRIANGLE's unicode code point is U+25C0(@"\U000025C0"), and you can specify not to use Apple Color Emoji but non-color symbol like @"\U000025C0\U0000FE0E".

Also, there is some difference between iOS emulator(for iOS6 on Mountain Lion) and actual device(iOS6) about Variation Selector handling, probably because Mountain Lion have more support for Unicode 6.1, I guess.

For example, if I don't specify the selectors, I see non-color triangle on iOS6 device, but Apple Color triangle on iOS6 simulator(on Mountain Lion), for UIBarButton.

So, it is nice to check both simulator and actual device, but it looks more safe to use Unicode Variation Selectors always anyway.

like image 58
Tsuneo Yoshioka Avatar answered Nov 07 '22 04:11

Tsuneo Yoshioka


It was kind of challenging to force the Browser to render the HTML Entity on iPads/iPhones, but I managed to find the solution, and here's the trick.

Instead of using HTML entities directly:

&#9664; <!-- ◀ BLACK LEFT-POINTING TRIANGLE -->
&#9654; <!-- ▶ BLACK RIGHT-POINTING TRIANGLE -->

I created supportive elements in HTML, with the classes:

<span class="left-pointing-triangle">&nbsp;</span>
<span class="right-pointing-triangle">&nbsp;</span>

With the use of CSS ::after pseudo-element made the override of the content:

.left-pointing-triangle::after {
  content: "\25C0 \FE0E";
}
.right-pointing-triangle::after {
  content: "\25B6 \FE0E";
}

The important part is to use content: "\25C0 \FE0E", instead of just symbol itself content: "\25C0". It works flawlessly on both iPads and iPhones of different iOS versions.

like image 43
Farside Avatar answered Nov 07 '22 04:11

Farside


I use these unicode characters to stop iOS from fiddling:

Right-triangle: ► (&#x25ba)

Left-triangle: ◄ (&#x25c4)

Update

If further triangles are what you seek:

Up-triangle: ▲ (&#x25b2)

Down-triangle: ▼ (&#x25bc)

like image 12
ne1410s Avatar answered Nov 07 '22 03:11

ne1410s