Aref Shafaei
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Font-size logic In here, 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). We were thinking about two methods of acheiving this: ## 1. Relative On each zoom level, we have to make sure a typical font size is displayed like other texts on the page. The following is the mapping that we came up with: ```js zoomRatio = defaultZoom/currentZoom mappingRatio = max(imageWidth/containerWidth, imageHeight/containerHeight) fontSize = currentFontSize * mappingRatio * zoomRatio ``` This section describes how to calculate the mapping of the normal text size to the text size for the image. It's important to note that the dimensions of the image in the OSD viewer can vary for different images, meaning that the font-size mapping will also differ. To use the relative method, two values are required: the zoom ratio and the dimension mapping ratio. The zoom ratio indicates the portion of the original image that is displayed in the OSD viewer, while the mapping ratio provides information about the image's size relative to the OSD viewer viewport/container. By combining these two ratios, it's possible to scale the font-size of the image with respect to the normal display font-size. Pros: - It works on all the images. - Specific font-sizes will look same across all the zoom levels. - Images that have multiple zoom levels can have smaller or larger texts as needed. Cons: - We would have to disable the zoom. - Can be confusing for some users as zooming in/out does not have any effect on the specific font-sizes. ## 2. Absolute The font size mapping is done based on the image's actual size and doesn't change by zoom level. The following is the mapping that we came up with: ```js mappingRatio = max(imageWidth/containerWidth, imageHeight/containerHeight) ``` The absolute method differs from the relative method in that it doesn't take the zoom ratio into consideration. This means that we only need the mapping ratio to obtain the scaling factor between the image font-size and the display font-size. To clarify, in the relative method, the zoom ratio and mapping ratio are both used to determine the scaling factor. However, in the absolute method, the zoom ratio is not considered, so only the mapping ratio is needed. Pros: - The definition won't change based on zoom-level. - Easier to understand for the user. - No need to disable zoom. Cons: - For images with a large number of zoom levels, the font-size options might not be small enough(Although the font-size can go as small/large as the user wants, as the input is just number input). ## Different images ### Image 1 - Relative Link https://dev.atlas-d2k.org/~nikpawar/chaise-relative/viewer/#2/Gene_Expression:Image/RID=14-47ZA?waterMark=gudmap.org&meterScaleInPixels=3082824 - Absolute Link: https://dev.atlas-d2k.org/~nikpawar/chaise-absolute/viewer/#2/Gene_Expression:Image/RID=14-47ZA?waterMark=gudmap.org&meterScaleInPixels=3082824 - Image size: 18609 * 25932 - Number of zooms: 9 - Relative: - Works properly. - The con can be that if the user uses a small font-size at the zoomed in level, at the default or zoomed out level the font-size is too small to see. - Absolute - Works properly, even at the lowest zoom level the font-size 1 is visible and can be used. - Need to work on the border and resize sizing on zoom in. ### Image 2 - Relative Link https://dev.atlas-d2k.org/~nikpawar/chaise-relative/viewer/#2/Gene_Expression:Image/RID=16-ZHV8?waterMark=gudmap.org&meterScaleInPixels=4554686 - Absolute Link: https://dev.atlas-d2k.org/~nikpawar/chaise-absolute/viewer/#2/Gene_Expression:Image/RID=16-ZHV8?waterMark=gudmap.org&meterScaleInPixels=4554686 - Image size: 17435 * 17397 - Number of zooms: 9 - Relative: - Works very well. - Absolute - Works properly, even at the lowest zoom level the font-size 1 is visible and can be used. ### Image 3 - Relative Link https://dev.atlas-d2k.org/~nikpawar/chaise-relative/viewer/#2/Gene_Expression:Image/RID=16-2GQ8 - Absolute Link: https://dev.atlas-d2k.org/~nikpawar/chaise-absolute/viewer/#2/Gene_Expression:Image/RID=16-2GQ8 - Image size: 1024 * 1024 - Number of zooms: 5 - Relative: - Works properly. - Slight deviation in the font-size similarity at lower font-sizes. - Absolute - Works same as relative. As only one zoom level is available at this image size, both the methods work similarly. ### Image 4 - Relative Link https://dev.atlas-d2k.org/~nikpawar/chaise-relative/viewer/#2/Gene_Expression:Image/RID=14-47YP?waterMark=gudmap.org&meterScaleInPixels=3082824 - Absolute Link: https://dev.atlas-d2k.org/~nikpawar/chaise-absolute/viewer/#2/Gene_Expression:Image/RID=14-47YP?waterMark=gudmap.org&meterScaleInPixels=3082824 - Image size: 26017 * 31455 - Number of zooms: 9 - Relative: - Works properly. - Absolute - Works as it should.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully