monospace

Monospaced font/symbols for JTextPane

删除回忆录丶 提交于 2019-12-06 20:08:01
问题 I want to build a console-like output using JTextPane. Therefore I am using a monospaced font: textpane.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); This works fine for all kind of alphanum (like a-z, 0-9 etc.) characters, but when it comes to symbols like ' \u2588 ' (█), the font isn't monospaced anymore. Did I forgot something? Or isn't there a monospaced font which includes smybols? 回答1: Ok, first off, it sounds to me like you're trying to address a couple of different things here,

Setting WPF RichTextBox width and height according to the size of a monospace font

ぃ、小莉子 提交于 2019-12-05 14:03:37
I am trying to fit a WPF RichTextBox to exactly accommodate a grid of characters in a particular monospace font. I am currently using FormattedText to determine the width and height of my RichTextBox, but the measurements it is providing me with are too small--specifically two characters in width too small. Is there a better way to perform this task? This does not seem to be an appropriate way to determine the size of my control. RichTextBox rtb; rtb = new RichTextBox(); FontFamily fontFamily = new FontFamily("Consolas"); double fontSize = 16; char standardizationCharacter = 'X'; String

Monospaced font/symbols for JTextPane

我的未来我决定 提交于 2019-12-05 01:29:37
I want to build a console-like output using JTextPane. Therefore I am using a monospaced font: textpane.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); This works fine for all kind of alphanum (like a-z, 0-9 etc.) characters, but when it comes to symbols like ' \u2588 ' (█), the font isn't monospaced anymore. Did I forgot something? Or isn't there a monospaced font which includes smybols? CodeBlind Ok, first off, it sounds to me like you're trying to address a couple of different things here, so I'll try to address them both separately. 1. You need a font that is monospaced for all unicode

What's happened to Monospace in Android Lollipop?

旧巷老猫 提交于 2019-12-04 02:17:11
I have a style to use "monospace" in my Android App: <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar" > <!-- Customize your theme here. --> <item name="android:windowNoTitle">true</item> <item name="android:typeface">monospace</item> <item name="android:textColorPrimary">@android:color/white</item> <item name="android:itemTextAppearance">@style/MenuText</item> </style> <style name="M13Text"> <item name="android:typeface">monospace<

iOS Monospaced Custom Font

◇◆丶佛笑我妖孽 提交于 2019-12-02 11:25:18
问题 I have a custom font included in my Xcode 7, iOS 9 targeted project. I want to make the font monospaced. I tried this, and didn't work: let originalFont = UIFont(name: "My Custom Font", size: 18) let originalFontDescriptor = originalFont!.fontDescriptor() let fontDescriptorFeatureSettings = [ [ UIFontFeatureTypeIdentifierKey: kNumberSpacingType, UIFontFeatureSelectorIdentifierKey: kMonospacedNumbersSelector ] ] let fontDescriptorAttributes = [UIFontDescriptorFeatureSettingsAttribute:

How can I insert Monospace fonts into an image with opencv?

江枫思渺然 提交于 2019-12-02 05:04:25
问题 Currently, I am able to insert some texts of HERSHEY font into images with openCV API (putText). But it seems openCV are not supporting any monospace font. I was wondering how I can insert some Monospace or fixed-pitch texts into the image. 回答1: You could use PIL/Pillow for that aspect quite easily. OpenCV images are numpy arrays, so you can make a Pillow Image from an OpenCV image with: PilImage = Image.fromarray(OpenCVimage) Then you can draw with a mono spaced font using code in my answer

How can I insert Monospace fonts into an image with opencv?

荒凉一梦 提交于 2019-12-02 00:36:08
Currently, I am able to insert some texts of HERSHEY font into images with openCV API (putText). But it seems openCV are not supporting any monospace font. I was wondering how I can insert some Monospace or fixed-pitch texts into the image. You could use PIL/Pillow for that aspect quite easily. OpenCV images are numpy arrays, so you can make a Pillow Image from an OpenCV image with: PilImage = Image.fromarray(OpenCVimage) Then you can draw with a mono spaced font using code in my answer here . You only need the 3 lines after the comment "Get a drawing context" . Then you can convert back to

Getting character width in Javascript

和自甴很熟 提交于 2019-12-02 00:18:11
问题 I would like to get the width of a character for calculating the position of any given character (in pixels) inside a string. I figure this would be easy since I am using a monospace font but I have a problem. I have tried the suggestions in this answer but this doesn't work for large strings. The precision is too poor which means that it works and I can get the position of the first few characters in the string but after, say 10 characters, the precision is so bad that the position I get for

How to get monospaced numbers in UILabel on iOS 9

℡╲_俬逩灬. 提交于 2019-11-28 17:52:32
At WWDC 2015, there was a session about the new “San Francisco” system font in iOS 9. It uses proportional number rendering instead of monospaced numbers by default when linked against the iOS 9 SDK. There is a convenient initializer on NSFont called NSFont.monospacedDigitsSystemFontOfSize(mySize weight:) that can be used to explicitly enable monospaced number display. However I couldn't find the UIKit equivalent for this on UIFont . Rudolf Adamkovič Handy UIFont extension: extension UIFont { var monospacedDigitFont: UIFont { let newFontDescriptor = fontDescriptor.monospacedDigitFontDescriptor

How to get monospaced numbers in UILabel on iOS 9

随声附和 提交于 2019-11-27 10:50:42
问题 At WWDC 2015, there was a session about the new “San Francisco” system font in iOS 9. It uses proportional number rendering instead of monospaced numbers by default when linked against the iOS 9 SDK. There is a convenient initializer on NSFont called NSFont.monospacedDigitsSystemFontOfSize(mySize weight:) that can be used to explicitly enable monospaced number display. However I couldn't find the UIKit equivalent for this on UIFont . 回答1: Handy UIFont extension: extension UIFont { var