Once upon a day, Microsoft Windows had something wonderful that allowed you to adjust the font DPI. Typically, you could use small font or big font. If an application was programmed correctly, it would work properly, if not, you would get text truncated in tiny dialog boxes/windows. Because at Eiffel Software we were heavy users of big font (at the time we had 21” CRT monitors where everything would be blurry in small font, and you had really no choice but to use big font to be able to read the text), we made sure that EiffelVision would handle this well and it did.
Then came Windows 8/10 and Microsoft decided that this existing technology was not good enough and created something of a mess. We understand why but still they could have reused the existing infrastructure instead of creating another one. This requires some work on the internal of EiffelVision to support proper sizing of fonts and windows to handle them, multi-monitor support with various DPI settings. But even Microsoft doesn’t get it right. Anyone with a 4K screen at 200% and another screen at 100% has discovered that most Office apps don’t render properly.
I believe the quick solution is to change all the size computations involving fonts to be updated. Usually we say we want 8pt, from there we get the size in pixels of the string to display. Now, instead of asking for the size in pixels, we need to scale the initial font to match the scaling factor set for the monitor on which the text will be displayed, then can ask the underlying API to draw the text properly.
Manu
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Jonathan Ostroff <jonathan....@gmail.com>:
Dear Jonathan,
Alexander Kogtenkov has already answered but let me mention one reason why there is no simple way to accept just `f3’ as a function call where f3 is a variable (or more generally an entity, e.g. formal argument) of an agent type. The problem is that indeed `f3’ is a variable. It cannot be both a variable and a function call! As a simple experiment, take your code (minus the assignment of r3 to Result) and change the type of r3 from REAL_64 to
FUNCTION [REAL_64]
i.e. the same type as f3. The code compiles, as it should, since the instruction r3 := f3 is an assignment to a variable of a certain type of an expression (itself a variable) of the same type. Of course it does not do what you wanted (calling the agent, rather than just returning it), but its acceptability excludes acceptability of the “call f3” interpretation.
For the anecdote: Pascal fell into such a trap. The convention there (they hadn’t invented `Result’) is that the name of a function denotes the result to be returned by the function. With recursion, this is all fine for a function with arguments, where you can have an instruction such as factorial := n * factorial (n-1). The presence of an argument list distinguishes a recursive call (here on the right) from a denotation of the variable (on the left). But for an argumentless function?
The recent evolution of Eiffel has made it possible in most cases to “call an agent” – meaning: to call the routine associated with the agent -- in the same way that we call the associated routine. For example if p is an agent denoting a procedure r you can get the equivalent of r (arg1, …) (of course, you do not know what r is, that’s the whole idea) not only through the long form p.call ([arg1, …]) but also through simpler variants: p.call (arg1, …), with an implicit tuple, and just p (arg1, …), with an implicit call to `call’, i.e. exactly in the same way you call `r’ directly. But for argumentless functions, i.e. the case you raised, one has to retain just a trifle of the extra baggage (in the forms explained by Alexander) to avoid ambiguity.
Thanks for raising the issue and best regards,
-- Bertrand Meyer
But even Microsoft doesn’t get it right. Anyone with a 4K screen at 200% and another screen at 100% has discovered that most Office apps don’t render properly.
I believe the quick solution is to change all the size computations involving fonts to be updated. Usually we say we want 8pt, from there we get the size in pixels of the string to display. Now, instead of asking for the size in pixels, we need to scale the initial font to match the scaling factor set for the monitor on which the text will be displayed, then can ask the underlying API to draw the text properly.
There is also the question of including default library bitmaps. I think hard coding them like in the docking library is not a viable method for high DPI. I suggest using a wrapper for librsvg library or the Cairo library and getting the application to draw them at the required DPI. Eiffel-Loop has wrappers for both, but the binaries only work with SDK 7.1. But in theory the underlying C libraries could be compiled for later versions. These libraries work very well and have support for anti-aliasing, transparencies and opacity setting. Eiffel-Loop can render all graphical resources at runtime from a mixture of SVG and high resolution images. But for better performance there is a disk caching mechanism.
I didn't test it on Windows yet (the Vision2 adapter I mean),
but it should work because I'm using a EV_PIXEL_BUFFER to translate the image and not any GTK internal function.
create
default_create, make_with_pixmap, make_with_size, make_rgb_24_with_pixmap,
make_rgb_24_with_size, make_with_path, make_from_svg_image
feature {NONE} -- Initialization
make_with_size (a_width, a_height: INTEGER)
--- make alpha rgb 32 bit format
make_rgb_24_with_size (a_width, a_height: INTEGER)
-- make rgb 24 bit format
make_with_pixmap (a_pixmap: EV_PIXMAP)
-- make alpha rgb 32 bit format
make_rgb_24_with_pixmap (a_pixmap: EV_PIXMAP)
-- make rgb 24 bit format
make_with_path (a_png_file_path: EL_FILE_PATH)
-- make from a PNG file
make_from_svg_image (svg_image: EL_SVG_IMAGE; a_background_color: EL_COLOR)
feature -- Conversion
to_pixmap: EL_PIXMAP
-- Convert to EV_PIXMAP.
to_rgb_24_buffer: EL_DRAWABLE_PIXEL_BUFFER
exploring your library further, I have to commend that it has excellent coverage of the many operations available in the Cairo library but this does require the user to get familiar with the Cairo way of doing things. The coverage in Eiffel-Loop I must confess is rather limited by comparison. Basically I was only interested in ones that would enable a particular project but has the advantage that it is easy to use for people who are used to the Vision2 way of doing things.
I didn't test it on Windows yet (the Vision2 adapter I mean),I have extensively tested the Eiffel-Loop Cairo wrapper on Windows and my experience was that it was not a trivial matter to get it working. In fact it took weeks to get it right. This was because of the large number of DLL dependencies that must be managed. I developed this scons script to manage the DLLs. It downloads a large GTK archive and then extracts all the DLL's necessary for both Cairo and librsvg, then it builds the static library stubs using MS VC, and does this for both win32 and win64. The general Eiffel-Loop build system takes care of invoking the build script and then copying the required DLL's into the application bin directory if the Vision2-x library is included in the application.
I had a look at your library. Conceptually we have a different approach. Cairo has a different conceptual model to the Vision2 drawing area model. What i have done in my wrapper is to "shoehorn" Cairo to match the Vision2 way of doing things so as a library user you are not required to deal with any Cairo concepts (or objects) but instead continue to think (as much as possible) in the familiar Vision2 model. The Cairo implementation details are completely hidden from the user. All of the Cairo functionality is accessed via EL_DRAWABLE_PIXEL_BUFFER which inherits EV_PIXEL_BUFFER.
One other observation is that Eiffel_Cairo seems to be based purely on a statically linked implementation. This is fine for GTK but I think this approach might very difficult to get working with the MS VC compiler. In Eiffel-Loop the Windows implementation is dynamically loadable as it seemed the less daunting approach and worked well in practice. But this did require some additional abstractions to make a common Linux/Windows API interface. See Windows EL_CAIRO_API v GTK EL_CAIRO_API