Restrict Font Height in Emacs - emacs

I am using the default monospace font of Fedora 17 in Emacs (DejaVu Sans Mono). Unfortunately, the bold form of this font takes up more vertical space then the regular form. This means that whenever I type in text that becomes bold, all the lines on the screen move a little down. Similarly for when I highlight regions of text containing bold text.
Is there a way I can force EMACS to use exactly the same height for both the regular and bold forms of this (or any) font?

Related

Why is my 80 character ruler between Sublime Text3 and VS Code so different?

I have my ruler settings in Sublime Text 3 and VS Code at 80. In my sublime image I separate my functions using "#---#" which is as wide as the 80 character ruler. When I open the same file in VS code the ruler is nowhere near the 80 character limit, its somewhere in the hundreds. Does anybody know what's going on?
Below is a screenshot from Sublime Text 3
Below is a screenshot from VS Code:
Notice the different placement of the 80 character ruler.
It looks as though you're not using the same font in both cases, and in fact the font in Sublime is Fixed Width while the font in VSC is Proportional.
This is visible not only in the rulers, but in the code itself. For example, presuming it's the same file in both screen shots, the indent looks to be 4 characters in Sublime and 3 in VSC.
Both things are a symptom of a Proportional font; a font in which the width of each character is potentially distinct, unlike a Fixed Width font in which every character is the same width.
In a Fixed Width font, an X and a dash are the same width (for example), but in a Proportional font a dash is usually narrower (and a space much more so). As a result the ruler being at character position 80 doesn't line up with the actual character at position 80 because the text isn't long enough.

Enlarging text while having line numbers enabled covers the view of the numbers?

Enlarging text while having line numbers enabled covers the view of the numbers?
I've enabled line numbers globally by adding (global-linum-mode t) to init.el.
Zooming in on text using the C-x C-+ keybinding results in the behavior seen below, which is not satisfactory.
What can I do to fix this? Are their working alternatives?
I don't see this problem, using library zoom-frm.el (see also Emacs Wiki page Set Fonts).
But vanilla Emacs clearly has another bug, in that enlarging the text by scaling enlarges the horizontal space used for the line numbers (good), but shrinking the text then does not shrink that space used for line numbers (bad). I've just now filed Emacs bug #24164 for this.

I need to have a UiLabel displaying two integers "minutes:seconds" without shifting left and right as the numbers change

I have created a countdown timer "Minutes:Seconds" the logic works but I have a display issue. As the numbers change the uilabel text shifts ever so slightly left and right and it is ugly. Any ideas?
This is how I change the label currently
let strMinutes = String(format:" %02d",minutes)
let strseconds = String(format:"%02d",displayseconds)
displayTimeLabel.text = "\(strMinutes):\(strseconds) "
To prevent your digits from shifting, use a font with mono-spaced digits such as Courier New Bold, Helvetica Neue, Verdana, American Typewriter, Chalkboard SE, Copperplate, Gill Sans, Marker Felt, or Trebuchet MS.
You set this in the Attributes Inspector for the label:
I would suggest setting the Alignment to center your text as well.
You can do your code in one line:
displayTimeLabel.text = String(format: " %02d:%02d ", minutes, displayseconds)
I think an option would be choose a Mono spaced font. To do this, you can select your label and open the "Utilities" panel. Then show the "Attributes inspector" and finally in "Font". There, you can select "Fonte: Custom" and choose a monospaced font like Courier New Bold and Helvetica Neue
Change your text alignment to center, and set the width of your label to have enough padding on both sides so that its width doesn't change when the content changes. That way you can use any font, doesn't have to be monospaced.

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".

CoreText: How to keep a fixed line height and baseline when using different fonts of same point size in one line?

I'm implementing a custom rich text editor, most part of it works fine, it uses core text to layout and display text.
But I've run across a problem, when I have a line of text that contains different fonts of the same point size ,for example, Helvetica size 17 and STHeitiSC-Light size 17, the line height will be taller than lines containing only STHeitiSC-Light,size 17.
I found that the descender of Helvetica is bigger than that of STHeitiSC-Light ,
when there are both Helvetica and STHeitiSC-Light, line ascender,descender,leading are A/D/L = 14.62/3.90967/0.51,
when there is only STHeitiSC-Light, it's A/D/L = 14.62/2.38/0.51.
Also, when there are only STHeitiSC-Light text in the line, then add a Helvetica character, the base line of those STHeitiSC-Light text will be moved(because the baseline of this line is changed), making a bad user experience.
So, how to keep a fixed line height and baseline when using different fonts of same point size in one line?
cou