I want to use Jfree chart with itext to make a pdf. I have used custom font for JFree chart title and its other components using java.awt.Font class. It works ok in windows but on linux centOS, the title is overlapping with upper line and so do other things. Need help.
Thanks
Found the answer. It's because the two platforms are using different version of java. On Windows its java (SE) 1.6 and on linux I was using openjdk. By making both java SE, problem's solved.
Related
All my fonts are appearing pixelated, so I used AntiAliasing but it isn't helping out. As you can see the pixelated font in the image itself:
This is the code I am currently using:
butt1 = QtWidgets.QLabel("""Scrappr""")
font = QtGui.QFont()
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
font.setPixelSize(22)
font.setFamily('Segoe UI Bold')
butt1.setFont(QtGui.QFont(font))
I tried different solutions on SO, qtforums etc but nothing works for me :(
I tried:
Different combinations of ClearType text but It didn't work out as, by default all the text appears good on windows and chrome but with Qt only, it becomes pixelated.
Changing windows aero theme to classic one...
But none of them helped.
Here are My PC Specs:
windows: 7 ultimate
PySide2 version: 5.14.2.1
Resolution: 1360 X 768
I'm using BrownPro font and the texts were blurry at all resolutions, but much more evident at low resolutions.
I was able to solve the issue by setting the hinting preference for the font to: PreferNoHinting. Applying it at the application level, fixes the issue everywhere.
Here is the documentation: https://doc.qt.io/qt-5/qfont.html#HintingPreference-enum
And here is the code I used:
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/BrownPro-Light.ttf");
QFont brown_pro_font("BrownPro");
brown_pro_font.setHintingPreference(QFont::HintingPreference::PreferNoHinting); //This line did the trick
QApplication::setFont(brown_pro_font);
Try to see the fonts used by PyQt5:
import PyQt5
from pyQt5 import QtGui
dir(QtGui.QFont)
the result will show all you need for QFond and the fonts can be used:
[..., 'Helvetica',...,'SansSerif',..., 'Serif',..., 'Times', ...
You can try to add your custom fonts but you need to test each font.
For example, the documentation tells us:
In Windows a request for the “Courier” font is automatically changed to “Courier New”, an improved version of Courier that allows for smooth scaling. The older “Courier” bitmap font can be selected by setting the PreferBitmap style strategy (see setStyleStrategy() ).
Once a font is found, the remaining attributes are matched in order of priority:
fixedPitch()
pointSize() (see below)
weight()
style()
I happen to work with Qt last year and i used qml for building the UI part of my application.
Qt itself prefers us to use qml for building UI, since they have written a UI engine that renders everything better compared to the old engines.
In case of PyQt you are using the python only approach which is only not usually recommended, i am not saying that the qml version is pixel perfect. it still works bad at drawing curves (but that is not the stuff we usually require). As far as your problem is concerned qml will work fine for you (it has much better text rendering).
You might struggle a bit finding the learning resource for qml. But at least give it a shot and yes it is easier much easier than Python only approach.
I am a new to openCV and trying its examples from documentation. I am doing the trackbar as the color palette example.
But my UI renders in wrong order as well as crops the switch title: OFF.
where it is supposed to be like this.
I am using macbook pro with macOS 10.13.
OpenCV's Highgui module uses QT as a backend. QT renders elements differently depending on the OS that is using it. I believe that this is because QT uses UI elements that are native to the OS. So a frame in Windows will look like a Windows Frame, a frame in Linux will look like a Linux frame.
This is what the same example produces in Windows:
You can get the slider bars to fit the window by changing:
cv2.namedWindow('image')
to:
cv2.namedWindow('image',cv2.WND_PROP_AUTOSIZE)
Doing that produces this output (in Windows):
I was casting around for a solution for to another question I had ( Stretch text in inkscape, but then wrap it to a path ) and I wondered if it was possible to easily and programmatically make one font from another? As a concrete example, can I take FreeSerif font, double its height, and produce another font, calling it FreeSkinnySerif? (I could then use FreeSkinnySerif in Inkscape and get the effect I'm after.)
FontForge Scripting might work for you, in particular scale. I suggest trying out the command in the GUI first, than create the script.
I don't know about a scripting solution, but have you tried the SVG Font editor that is built in to Inkscape?
Text->SVG Font Editor.
I guess that you could make a python script that used it somehow, but simply using the tool from inkscape would probably bee faster.
Here is a tutorial.
I'm stuck in a problem, the font I want to use can't save in pdf, STHeiti and STXihei they are both the default Chinese fonts in Mac os.
illustrator give me this error, I don't know how to change the font to make this work,
I know a software in windows named Font Creator that looks promising, But I don't know exactly how to use it
This is a licensing restriction imposed by the distributor of this font, there is no way to legally embed it in a PDF.
Is there any way to make the fonts render as anti aliased in Windows, when using font-face embedding?
http://code.google.com/webfonts looks much better on Ubuntu/Mac, as compared to Windows 7 (tried chrome/firefox)
I just found a great solution for this old problem. If you serve the svg format of your font before woff, Chrome on windows will anti-alias and render your font properly.
I'm using this technique on my demo page here. You can see the headers and the icon fonts are all smooth and properly anti-aliased.
above recommendations to turn on cleartype are sadly incorrect. Cleartype makes embedded fonts jagged – turning clertype OFF makes them smooth. i don't know why this is, but it sure is frustrating.
This should force Chrome on Windows to anti-alias:
-webkit-transform: rotate(-0.05deg);
I'm not aware of any solution for Firefox.
Ensure you've got clear-type turned on. Thats-anti aliasing for your windows.
Looks like there's no Anti-aliasing present for embedded fonts in any version of Windows yet.
have you tried the css3 font smoothing
font-smooth: auto | never | always | <absolute-size> | length | initial | inherit