Open RFSH opened 1 year ago
For the font-size functionality we are going to try two different ways:
Absolute Font-size For this functionality, we need a mapping between the image font-size and the font-size outside the OpenSeadragon viewer application. This is needed because the pixel density of the images can be very high or low as compared to the rest of the web application. To achieve this we use the OpenSeadragon viewport container size and the dimensions of the image. The formula used to achieve this mapping is:
mappingRatio = max(imageWidth/containerWidth, imageHeight/containerHeight)
We then use this mapping ratio and multiply it by the user selected font-size to obtain the image font-size that would look like regular font-size. Other relative attributes use this font-size as well.
Relative Font-size The idea is to basically incorporate the zoom level, so that the font-size would look same as the web application at all the zoom levels. I'm trying a few approaches for this:
One of these two approaches should work. I'm currently working on this.
Relative Font-size As mentioned in the previous comment, the second proposed method did not work. As we are using multi-image configuration for the OSD viewer application, the values returned by the OSD viewer functions is not accurate and reliable. I went ahead with the first method. In order to obtain the current zoom level, we are taking the current zoom level of the viewport object of the OSD viewer. We are also retrieving the default zoom level that we set while creating the OSD viewer object that is used at the start when the image is loaded. Using the default zoom and the current zoom we calculate a zoom ratio that provides us information about how zoomed-in or zoomed-out an image is. We then use this zoom ratio in the calculations of the font-size formula.
zoomRatio = defaultZoom/currentZoom
mappingRatio = max(imageWidth/containerWidth, imageHeight/containerHeight)
fontSize = currentFontSize * mappingRatio * zoomRatio
We had a conversation about this, and the following is the summary of what we talked about:
The following are other improvements that came up as part of this discussion:
We've implemented the "absolute" method that is described above. We should discuss whether we need to make any changes to this logic.
As part of #102, we're adding a text drawing tool. The following is how it works:
During drawing,
In this issue, we want to explore the heuristics for the default font size and allow users to pick a meaningful font value. We should try to come up with uniform heuristics, so users pick font size values that they are familiar with (12px, 14px) and not the actual pixel size we'll show on the image (we would have to pick 1000px font size for images with multiple zoom levels).
Should the font size heuristics be absolute or relative to the zoom level? In both cases, we would have to factor in the image's size (width/height).
Based on this, we will try the "absolute" method first. We should see if we can develop a heuristic that makes sense for an image with 7 allowed zoom levels. And then see if the same heuristics make sense when we have only 2-3 zoom levels.
The following are the things that came up during the discussion: