Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am writing code that draws a simple line graph to the Console, and can use Unicode characters. I am looking for the best way to encode 45° angled lines into my graphs.
For instance, here's a 2x2 block of Unicode characters, representing a 45° angled line intersecting a vertical line:
│
│╲
In an ideal world, I'd like to find a set of Unicode characters which fits in the same 2x2 space and touches the edges in the same spots, but the diagonal line reaches all the way to the vertical one somehow.
The closest thing I've found is that you could replace the vertical line with ▕, like this, but then the vertical bar won't touch the edges in the same spots, so it won't cleanly fit the rest of the graph.
▕
▕╲
Any other ideas?
Different fonts draw "one eighth block" differently, so you just need to choose the font that better suits your needs, e.g.:
- Hack font
- Segoe UI
- MS Gothic
Other characters, that may be come in handy:
U+2595: ▕ (Right one eighth block)
U+258F: ▏ (Left one eighth block)
U+2571: ╱ (Light diagonal upper right to lower left)
U+2572: ╲ (Light diagonal upper left to lower right)
U+2573: ╳ (Light diagonal cross)
More drawing characters:
https://en.wikipedia.org/wiki/Box-drawing_character
one of these might work. The Font is the Symbola Font. The Hex column is the hex representation for the unicode font shown on the right.
Related
I am drawing text in a PDF page using iTextSharp, and I have two requirements:
1) the text needs to be searchable by Adobe Reader and such
2) I need character-level control over where the text is drawn.
I can draw the text word-by-word using PdfContentByte.ShowText(), but I don't have control over where each character is drawn.
I can draw the text character-by-character using PdfContentByte.ShowText() but then it isn't searchable.
I'm now trying to create a PdfTextArray, which would seem to satisfy both of my requirements, but I'm having trouble calculating the correct offsets.
So my first question is: do you agree that PdfTextArray is what I need to do, in order to satisfy both of my original requirements?
If so, I have the PdfTextArray working correctly (in that it's outputting text) but I can't figure out how to accurately calculate the positioning offset that needs to get put between each pair of characters (right now I'm just using the fixed value -200 just to prove that the function works).
I believe the positioning offset is the distance from the right edge of the previous character to the left edge of the new character, expressed in "thousandths of a unit of text space". That leaves me two problems:
1) How wide is the previous character (in points), as drawn in the specified font & height? (I know where its left edge is, since I drew it there)
2) How do I convert from points to "units of text space"?
I'm not doing any fancy scaling or rotating, so my transformation matrices should all be identity matrices, which should simplify the calculations ...
Thanks,
Chris
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using Photoshop CS6.
I have images in small sizes(3.5mm X 3.5mm).
I enlarge the image size in(10cm X 8 cm).
Then the image quality are going low..
SO how to enlarge the images without affect the resolution.
BiCubic Smoother is not satisfied me..
Is there any way to resize images to high resolutions without losing pixels.
If you enlarge an image with a factor of 6:1 (as in this case) you will have an image missing 5/6 of information that need to be "filled" with constructed information by mathematical means. In most cases interpolation (bi-cubic or otherwise) is used.
Unfortunately this will never result in anything sharp and high quality due to the nature of interpolating (basically averaging the constructed color points between the actual pixels). The picture will appear blurry no matter what you try to do in a case like this.
You can always throw a sharpening convolution on it, but the result will never be ideal.
For example, lets say I have a 2x1 pixel image that looks like this (enlarged for example):
If I now want to enlarge this image using interpolation I will end up with an image containing information like this:
As you can see two points between the black and white needs to be reconstructed. As there is no way of knowing how these points would look like (as they never existed in the image in the first place) we need to guess how they would look like by averaging the black and white points.
This will result in a "gray scale" that will result in the image looking blurry.
The more complex interpolation algorithms can make a better guess by using more points to get a Bezier approach for the non-existing points and so forth, but it will always be a good guess at best.
Now, this example uses 2:1 enlarging. You can probably by now imagine then how 6:1 scale will appear.
It is impossible in this way. you will lose quality because your image and Photoshop are pixel based.
you can convert your picture to vector using softwares like corel draw.
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.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I know how to do simple things with images at the pixel level like applying grayscale, sepia, etc. I'd like to find some articles on how to apply saturation, hue, brightness, contrast, etc at the pixel level, and I'm having trouble getting anything useful from my google searches.
Since pixels are usually represented as RGB (red, green, blue) values, it's often more useful to convert them to another color space to manipulate them, e.g. HSB (Hue, Saturation, Brightness) - that way you can change those values individually more easily.
If you search for RGB to HSB conversion you should find examples of how to do it (I think I found some useful code on Wikipedia).
Obviously after you've manipulated the pixels (e.g. multiplying the saturations by 0.2) you then have to convert them back to RGB for display.
Sorry if this isn't the right overflow for this question. I need a unicode character that is as long as ⎢ (23A2, LEFT SQUARE BRACKET EXTENSION) but lines up horizontally with ⎮ (23AE, INTEGRAL EXTENSION). Is there such a character?
Take a look at shapecatcher. If you draw a straight line, it shows plenty of different codepoints resembling |.
As already pointed out, exact placement and size may depend on the font, but if you know that the font is going to be a specific one (because you supply it), you could still find the character you're looking for.
It turns out this does depend on the font. If I use DejaVu Sans Mono, INTEGRAL EXTENSION is as long as I want it to be. This font appears to be almost exactly the same as the font I was using, Menlo, except for some small differences with some characters (including this one).