How can we change editor font in octave in ubuntu 18? - octave

It is very difficult to read the code due to very small font of octave editor. I am unable to find where to change this font setting for editor text.
I am attaching the screenshot of the octave editor platform.
I expect to increase my editor font to work properly.Thanks

You can change the entire Ubuntu font by
gsettings set org.gnome.desktop.interface text-scaling-factor [font size ]
Example :
gsettings set org.gnome.desktop.interface text-scaling-factor 1.4
to know about current font use following command
gsettings set org.gnome.desktop.interface text-scaling-factor

Related

Powershell v7 Text Background highlighting

So I set up my new laptop with both powershell 5.1 to powershell 7 and I just have this weird problem with powershell 7 where it highlights the background of the text which I just don't like.
I do not face this problem with powershell 5.1.
I tried to change that background in the color scheme in "settings.json" to an alpha channel for transparency but powershell doesn't accept rgba values so it errors out.
Here's an example image of the problem I'm facing
PowerShell 7:
PowerShell 5.1:
Please help me resolve this issue :)
PowerShell 7.2 introduced the automatic variable $PSStyle for a new feature called PSAnsiRendering. You can use ANSI rendering to control text decorations, such as colour and font styling, in PowerShell. See Get-Help about_ANSI_Terminals for more information.
This includes File Info formatting when using Get-Childitem, you can alter the formatting with $PSStyle.FileInfo.Directory for example
$PSStyle.FileInfo.Directory = "`e[4;1m"
Or disable with
$PSStyle.OutputRendering = "Plaintext"
If you'd like to keep this consistent for each session then you'll need to add it to your PowerShell profile script.

LaTeX in R Notebook not rendering properly in HTML (hats are skewed to the right)

When I output an r Notebook to html, and use latex, most of the output renders fine.
When I use hats though, it's not lined up properly on the character I'm 'hatting'.
For example:
---
title: "R Notebook"
output: html_notebook
---
Hello Everyone, $\pi = 3.14159...$ but my estimate is $\hat{\pi}=3.13$
Outputs into an HTML file:
Even though, when I hover over the latex in the code, it renders properly:
Another thing I now notice is that, the latex output font when I hover is nicer than the HTML output, is it possible to change the HTML output font to the 'hovering' font?
EDIT: My OS and software versions are MacOS Catalina 10.15.3 with RStudio version 1.1.456
It turns out I just needed an RStudio update, and it solved the problem. I'd tried updating RStudio through the application, but since I had the option 'Ignore Updates' it would always notify me that I had the latest version, so I had to download the .dmg from the website and re-install.
If anyone can help me change the font though, I'd really appreciate it.

Convert .ttf file to .png

Is there any way to convert a TTF to PNG files? Or any other method to create Sprite out of TTF file in LIBGDX framework? Is there any application available for it?
Before running
LibGDX has a built-in tool in the gdx-toolsproject called Hiero. Just run that project as a java application, and when asked which class to run, choose that one. It lets you take a .ttf file and render it the characters you need (in a size given in pixels), plus it generates a file that contains information about where each character is on the texture. In the program, it's very simple to initialize and use:
BitmapFont font = new BitmapFont(Gdx.files.internal("data/font/font.fnt"));
...
font.draw(spriteBatch, "Text to output", coordX, coordY);
(font.fnt is the file containing the texture positions and other relevant information, it also refers to the .png which is created in the same folder by default.)
You can take a look at the BitmapFont documentation here.
During runtime
A disadvantage of Hiero is that bitmap fonts don't really scale well, so they can look quite bad on different screen resolutions.
Take a look at this answer to a related question:
One solution is to use the FreeType extension to libgdx, as described here. This allows you to generate a bitmap font on the fly from a .ttf font. Typically you would do this at startup time once you know the target resolution.
I haven't personally used it, but it seems like something worth checking out. It looks very simple as well - the example code in the linked answer is 5 lines long.
Finally I got the solution to the same problem(TTF to PNG) which I faced too.
Follow the below steps,
1. Convert TTF to SVG
Use TTF to SVG conversion tool to convert your custom or downloaded TTF file to SVG file
2. Convert SVG to PNG/PDF/TTF:
Goto IcoMoon, in the top left corner, there will be button to Import Icons, click and upload your converted SVG file.
In the bottom bar, there will be an option "Generate SVG & More" as in the below image, click on it
Next, Click the Settings gear icon near "Download" option to override size, output formats(PDF,PNG,etc.,) and then close the Settings
Now click download to get the outputs into a single zip file !!!
A ttf is a true-type font. It is not a picture, but a vectoric character set. You can't convert it to a picture simply with a tool.
If you want to view/manipulate ttf files, you can do this with ttf editing tools, for example fontforge ( http://fontforge.sourceforge.net ).
This may be an old question, but I found the following batch file works with ImageMagick 7:
#ECHO OFF
set f=wingding.TTF
set ps=800
set bg=white
set ext=png
set s=600x600
set alpha=A B C D E F G H I J K L M N O P Q R S T U V W Z Y Z
set num=0 1 2 3 4 5 6 7 8 9
For %%X in (%alpha% %num%) do (
convert -font %f% -pointsize %ps% -size %s% -background %bg% label:%%X
%%X.%ext%)
pause
exit
NOTE: This conversion only works with a limited selection of font characters. It works well for all capital letters. Just install ImageMagick and make sure it is in your environment path. Include "legacy" commands in your installation.

How to change font in ipython notebook

I am fairly new to python and have no html experience. The question has been asked and either not answered at all or not answered in enough detail for me to set the default font within iPython (not change to browser). Specifically, what has to be put in the css file and which css file should be used? I am on a Windows system.
For reference, these are in answer to the linked SO questions below:
in #1: an unnamed file in /usr/lib/python2.6/.../css/
in comment to #1: change monospace font in browser - worked but font is italic
in #2: custom.css in profile subdirectory /static/custom/custom.css
Related questions:
Change ipython notebook font type
Change font & background color in ipython notebook
Changing (back to default) font in ipython notebook (unanswered) -
Edit:
Changing the monospace font in my browser worked, as suggested in an answer comment of #1. However the font is italic, which is not what is intended.
You can hover to .ipython folder (i.e. you can type $ ipython locate in your terminal/bash OR CMD.exe Prompt from your Anaconda Navigator to see where is your ipython is located)
Then, in .ipython, you will see profile_default directory which is the default one. This directory will have static/custom/custom.css file located.
You can now apply change to this custom.css file. There are a lot of styles in the custom.css file that you can use or search for. For example, you can see this link (which is my own customize custom.css file)
Basically, this custom.css file apply changes to your browser. You can use inspect elements in your ipython notebook to see which elements you want to change. Then, you can changes to the custom.css file. For example, you can add these chunk to change font in .CodeMirror pre to type Monaco
.CodeMirror pre {font-family: Monaco; font-size: 9pt;}
Note that now for Jupyter notebook version >= 4.1, the custom css file is moved to ~/.jupyter/custom/custom.css instead.
In JupyterNotebook cell,
Simply you can use:
%%html
<style type='text/css'>
.CodeMirror{
font-size: 17px;
</style>
I would also suggest that you explore the options offered by the jupyter themer. For more modest interface changes you may be satisfied with running the syntax:
jupyter-themer [-c COLOR, --color COLOR]
[-l LAYOUT, --layout LAYOUT]
[-t TYPOGRAPHY, --typography TYPOGRAPHY]
where the options offered by themer would provide you with a less onerous way of making some changes in to the look of Jupyter Notebook. Naturally, you may still to prefer edit the .css files if the changes you want to apply are elaborate.
The new location of the theme file is: ~/.jupyter/custom/custom.css
In your notebook (simple approach). Add new cell with following code
%%html
<style type='text/css'>
.CodeMirror{
font-size: 12px;
}
div.output_area pre {
font-size: 12px;
}
</style>
Using Jupyterthemes, one can easily change look of notebook.
pip install jupyterthemes
jt -fs 15
By default code font size is set to 11 . Trying above will change font size. It can be reset using.
jt -r
This will reset all jupyter theme changes to default.
In addition to the suggestion by Konrad here, I'd like to suggest jupyter themes, which seems to have more options, such as line-height, font size, cell width etc.
Command line usage:
jt [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT]
[-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE]
[-m MARGINS] [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-vim]
[-cellw CELLWIDTH] [-lineh LINEHEIGHT] [-altp] [-P] [-T] [-N]
[-r] [-dfonts]
For chrome users, This is very simple.
Just install the desired font in your OS. Then open the said browser, Go to
Settings -> Appearance -> Customize font.
Go to fixed width font and from drop down list select the desired font.
Note: This might also change the fonts at some other places depending on the web pages that you visit.
There is a much easier way to do without adding the CSS files and all the other methods suggested. But you have to do it every time you start the Jupiter notebook.
Go to inspect in your browser and click on the element selection icon and then click on the box.
And at the bottom of the page, you will be seeing the styling option for CSS where you can easily change the font-size.

Tesseract does not recognize single characters

How to represent:
Create new image with paint (any size)
Add letter A to this image
Try to recognize -> tesseract will not find any letters
Copy-paste this letter 5-6 times to this image
Try to recognize -> tesseract will find all the letters
Why?
You must set the "page segmentation mode" to "single char".
For example, in Android you do the following:
api.setPageSegMode(TessBaseAPI.pageSegMode.PSM_SINGLE_CHAR);
python code to do that configuration is like this:
import pytesseract
import cv2
img = cv2.imread("path to some image")
pytesseract.image_to_string(
img, config=("-c tessedit"
"_char_whitelist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
" --psm 10"
" -l osd"
" "))
the --psm flag defines the page segmentation mode.
according to documentaion of tesseract, 10 means :
Treat the image as a single character.
so to recognize a single character you just need to use : --psm 10 flag.
You need to set Tesseract's page segmentation mode to "single character."
Have you seen this?
https://code.google.com/p/tesseract-ocr/issues/detail?id=581
The bug list shows it as "no longer an issue".
Be sure to have high resolution images.
If you are resizing the image, be sure to keep a high DPI and don't resize too small
Be sure to train your tesseract system
use the baseApi.setVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); code before the init Tesseract
Also, you may look into which font to use with OCR