Setting button title as unicode character - swift

I have a custom circular button on which I wish to set the lower left pencil unicode as title. I had tried setting the image, but for some reason the image isn't showing up, so I thought of showing the unicode character.
Unicode for lower left pencil is - U+1F589 (Resource - https://www.fileformat.info/info/unicode/char/1f589/index.htm)
Code - customButton.setTitle("\u{1F589}", for: .normal)
Issue - Doesn't work and just shows a question mark on the button.
If I use unicode for lower right pencil, then it works fine.
Code for right pencil - customButton.setTitle("\u{270E}", for: .normal)
Why isn't the code for left pencil working? Am I using the wrong way to set unicode characters for left pencil?

To display a character, it needs to be part of a font, and there is no system font on iOS or Mac that includes this character. In fact, I could only find two fonts on all of fontspace that include it. It is a very rare character.
Since it's been around since 2014 (Unicode 7.0), I doubt it will ever be picked up. It's a kind of a weird character. Neither it nor LOWER RIGHT PENCIL are emoji, so they aren't generally going to display the way you'd want them to, anyway. They're text-only glyphs.
There are a bunch of similar emoji, though:
🖊 U+1F58A LOWER LEFT BALLPOINT PEN
🖋 U+1F58B LOWER LEFT FOUNTAIN PEN
🖌 U+1F58C LOWER LEFT PAINTBRUSH
🖍 U+1F58D LOWER LEFT CRAYON
There is a right facing version of LOWER LEFT FOUNTAIN PEN, U+2711 WHITE NIB (✒️), if you need a matched set. The Swift is "\u{2711}\u{FEOF}".

Your code is fine. You just need to find another character. Lower-right pencil is an old character that has been around for a while judging by its unicode properties (v1.1 versus 7.0). I guess they never thought the need for a lower-left pencil, until now, and it just needs more time before it's (hopefully) more-widely adopted.
https://util.unicode.org/UnicodeJsps/character.jsp?a=270e&B1=Show
Lower-right pencil renders on the official Unicode character property analyzer.
https://util.unicode.org/UnicodeJsps/character.jsp?a=1F589&B1=Show
Lower-left pencil, however, doesn't render.

Related

Characters in FontForge appear distorted

I'm trying to create a font using FontForge which is 'simply' the alphanumeric characters from Lato (original version) as well as the greek alphabet characters from Lato (extended version). I opened both fonts in FontForge and copied and pasted the greek letters over to the original version. I generated the font and displayed it in Google Chrome. But the characters that I've copied come out jagged / distorted. I've also tried opening the original font, then going to element and then merge fonts and selecting the extended version font and then generating a font from that but the same problem occurs.
The screenshot provided below shows the distortion going on. The top line shows how the letters should look. The bottom line shows how the letters actually look. Many of the letters - even the ones that were in the original (such as the 'a') - aren't displaying properly. The bottom and top of some characters has been flattened and for other characters, extended. Notice the top of the alpha, rho and epsilon are pointed and aren't smooth as they should be. The top of the beta has been flattened. Look at the top and bottom of the 'o' - both have been flattened as if to fit into a minimum allowable area.
If I zoom in a lot, the jagged edges become smooth again.
What can I do to fix this?

Unicode value for right arrow with two strokes

I want to use the → character with two // strokes through the arrow but cannot find the unicode value for it anywhere. Does this exist in unicode? If not, is there a way to recreate it?
There are six Unicode characters whose name matches a right arrow with a double stroke, making use of the regular expression: /right.*arrow.*double.*stroke/.
Only two characters appear to be relevant candidates:
⇻ U+21FB RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE
⭼ U+2B7C RIGHTWARDS TRIANGLE-HEADED ARROW WITH DOUBLE HORIZONTAL STROKE
(* RIGHTWARDS TRIANGLE-HEADED ARROW WITH DOUBLE VERTICAL STROKE)
Notes:
The official Unicode name of U+2B7C was initially wrong, but a corrected name has been added later as an alias.
U+2B7C appears to be quite uncommon, no suitable font was available in the OS used for the screenshot. Still, it is possible to see what it should look like in the Miscellaneous Symbols and Arrows - Range: 2B00–2BFF PDF document:
I was not successful in finding what you were looking for (negative result). U+0219B is a "Rightwards Arrow with Stroke" and U+021FB "Rightwards Arrow with Double Vertical Stroke". If it exist, it would probably be called "Rightwards Arrow with Double Stroke". https://en.wikipedia.org/wiki/Arrow_(symbol)
The following Unicode sequences should describe your character, but unfortunately fonts are not helping.
→⃫ : \u2192\u20EB
⟶⃫ : \u27F6\u20EB
They are normal and long arrow, with the combining U+20EB: COMBINING LONG DOUBLE SOLIDUS OVERLAY (long double slash overlay). You may find a technical font which can display both in the expected way.
You may get something acceptable also with:
⎯⎯⎯⃫⟶ \u23AF\u23AF\u23AF\u20EB\u27F6 (using arrow extension line)
⎯⎯⃫⟶ \u23AF\u23AF\u20EB\u27F6
Depending on the environment, one of the two seem much better (on my computers).
So: you can express it (semantically) with Unicode, but standards fonts are not helping us. You should experiment with many symbols/mathematical fonts, to get an acceptable solution.
As alternative, you can build such image easily with SVG (and use a SVG as character image).

Are there Unicode characters like these?

Are these findable? I've turned them myself because I could only find left and right. I want it to be the text of my buttons.
The closest match is probably:
PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET (U+FE3F): ︿
PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET (U+FE40): ﹀
Technically, these are punctuation characters from the CJK compatibility block used for vertical writing systems. What you're really looking for is an arrow-like symbol.
Try using a special font, like FontAwesome. Check out chevron-up and chevron-down.
I have to agree with some other responder, though, that SVG or even a sprite image would be better. You can set the text to be the unicode characters and style the element to show the image, so that selecting it and copying would give you the text.

Hide/change Emacs fringe bent arrows due to word wrapping?

I would like to change (or hide entirely) the "bent arrow" character that appears in the Emacs fringe (both on the left and right hand side). I'm using Emacs 24 on a Mac, installed via homebrew. I find it to be visually distracting. A smaller character, like a center dot, might work well.
For context, this is an official description of the small bent arrows (from http://www.gnu.org/software/emacs/manual/html_node/emacs/Continuation-Lines.html):
Sometimes, a line of text in the buffer—a logical line—is too long to fit in the window, and Emacs displays it as two or more screen lines. This is called line wrapping or continuation, and the long logical line is called a continued line. On a graphical display, Emacs indicates line wrapping with small bent arrows in the left and right window fringes. On a text terminal, Emacs indicates line wrapping by displaying a ‘\’ character at the right margin.
The Emacs LineWrap Wiki page does not address my question.
The best information I've found so far is contained in this StackOverflow answer:
When word-wrap is set to nil in a text terminal (-nw) Emacs, the backslash character appears on the right margin.
When word-wrap is set to t in a text terminal Emacs, the backslash character is not shown. Setting visual-line-mode also sets word-wrap to true.
This does not apply when Emacs is running as a GUI window: the small bent arrow appears on the right margin regardless of the value of word-wrap.
Is hiding or changing the bent arrows possible? If not, an answer that says, more or less, "I've looked at X and concluded that it is impossible" is ok too.
Update: Although it is not a terrible work-around, changing the fringes is not what I'm looking for: I want to customize the "bent arrow" character or bitmap.
First, some quick context. From Emacs Fringe Bitmaps: "Fringe indicators are tiny icons displayed in the window fringe to indicate truncated or continued lines, buffer boundaries, etc."
You cannot replace the curly arrow with arbitrary text. According to lunaryorn's answer to "Is It Possible To Replace Fringe Bitmaps With Text in Emacs?":
No, it is not. Fringe “bitmaps” are really bitmaps, that is vectors of 0/1 bits, overlayed over the fringe. There is no way to directly render arbitrary unicode characters onto the fringe. [...] What you can do, is to render a unicode character into a 0/1 bitmap yourself.
Like it says, you can change the bitmap. Fringe Bitmaps contains a list of fringe bitmaps; left-curly-arrow and right-curly-arrow are the ones relevant for this question.
Here is what I drew up. Adjust to your liking. Put this in your Emacs init file.
(define-fringe-bitmap 'right-curly-arrow
[#b00000000
#b00000000
#b00000000
#b00000000
#b01110000
#b00010000
#b00010000
#b00000000])
(define-fringe-bitmap 'left-curly-arrow
[#b00000000
#b00001000
#b00001000
#b00001110
#b00000000
#b00000000
#b00000000
#b00000000])
More documentation is available at Customizing Bitmaps, including set-fringe-bitmap-face which "sets the face for the fringe. If face is nil, it selects the fringe face. The bitmap's face controls the color to draw it in".

iOS japanese handwriting input code help please

I have a series of questions about writing code for iOS and including handwritten recognition of japanese. I am a beginner, so be gentle and assume I am stupid ...
I'd like to present a japanese word in hiragana (japanese phonetic alphabet), then have the user handwrite the appropriate kanji (chinese character). Then, this is internally compared to the correct character. Then, user gets feedback (if they were correct or not).
My questions here revolve around the handwritten input.
I know normally if one uses the chinese keyboard this type of input is possible.
How can I institute something similar, without using the keyboard itself? Are there already library functions for this (I feel there must be since that input is available on the chinese keyboard)?
Also, Kanji aren't exactly the same as chinese characters. There are unique characters that japanese people invented themselves. How would I be able to include these in my handwriting recognition?
We worked on a similar exercise back at University.
As the order of the strokes is well defined with kanji and there are only 8 (?) different strokes. Basically each Kanji is a well-ordered sequence of strokes. Like te (hand) is the sequence "The short falling backward stroke" and then twice the "left to right stroke" and finally "The long downward stroke with the little tip at the bottom". There are databases that give you this information.
Now the problem is almost reduced to identify the correct stroke. You will still run into some ambiguities where you have to take into consideration in which spatial relation some strokes are to some others.
EDIT: For stroke recognition we snapped the free hand writing to 45 degrees (Where is the little circle symbol on the keyboard?) angles, thus converting it into a sequence of vectors along one of these directions. Let's assume that direction zero is from bottom to top, direction 1 bottom right to top left, 2 from right to left and so on CCW.
Then the first stroke of te (手) would be [23]+ (as some write it falling and some horizontal)
The second and third stroke would be 6+
and the last would be 4+[123] (as with the little tip, every writer uses a different direction)
This coarse snapping was actually enough for us to recognize kanjis. Maybe there are more sofisticated ways, but this simple solution managed to recognize about 90% of kanjis. It couldn't grasp only the handwriting of one professor, but the problem was that also no human except himself could read his handwriting.
EDIT2: It is important that your user "prints" the Kanji and doesn't write in calligraphy, since in calligraphy many strokes are merged into one. Like when writing a kanji with the radical of "rice field" in calligraphy, this radical morphs into something completely different. Or radicals with a lot of horizontal dashes (like the radical of "speech" iu) just become one long wriggly line.