Font

Q: How to check what font a website uses?
A: Use the Develop > Show Web Inspector (⌥⌘I), and search in the page’s source code, “font-family”.

Tips: you can use cursor to inspect an element. Web inspector The source code of the selected element will be highlighted.

  • The font-family is under the Computed tab.
  • You can inspect the url or an image using this way.

Download and install a font

Download Mac system fonts

  • System fonts you can download show a download button in the Font Book app .
  • To install, do any of the following
    • In the Font Book app, choose File > Add Fonts to Current User. In the window that appears, double-click the font file.
    • Drag the font file to the Font Book app icon in the Dock, then click Install in the dialog that appears.
    • Double-click the font file in the Finder, then click Install in the dialog that appears.

Install other fonts

  1. Download the font file.

    Note: macOS supports

    • TrueType (.ttf), Variable TrueType (.ttf), TrueType Collection (.ttc),
    • OpenType and OpenType-SVG (.otf), and
    • OpenType Collection (.ttc) fonts.
    • Legacy suitcase TrueType fonts and PostScript Type 1 LWFN fonts might work but aren’t recommended.

    See the differences in these font files HERE.

    Choose where to install fonts:

    • Current User: Fonts are available only to you and are located in the Fonts folder in your home Library (~/Library/Fonts/).
    • All Users: Fonts are available to any user on this Mac and are located in the Fonts folder in the system Library (/Library/Fonts/).
  2. In the Font Book app , choose File > Add Fonts to Current User. In the window that appears, double-click the font file.

    When you’re installing fonts, Font Book lists any problems it finds for you to review. Font Book also checks for duplicate fonts.

When you install a font, there are typeface variations, such as, regular, bold, and italics.

A single font file contains only one font with one style (one of normal/oblique/italic) and one weight (one of normal/bold).

You do NOT need to install them all, only the ones you plan to use.

The full DejaVu fonts family contains following styles:

  • Sans: Book, Bold, Oblique, Bold Oblique, Condensed, Condensed Bold, Condensed Oblique and Condensed Bold Oblique, Extralight
  • Serif: Book, Bold, Italic, Bold Italic, Condensed, Condensed Bold, Condensed Italic and Condensed Bold Italic
  • Mono: Book, Bold, Oblique, Bold Oblique

Source DejaVu


Install the non-free MS Office fonts

It is possible to install the non-free MS Office fonts, which came with Office 2007 and Windows 7. Notably, this collection includes Calibri and Cambria, default fonts used in many MS Office documents.

Here we install the fonts available in the Microsoft PowerPoint Viewer (ppviewerFonts).

  1. Download the Microsoft PowerPoint Viewer executable:

     # download with `wget`
     wget https://archive.org/download/PowerPointViewer_201801/PowerPointViewer.exe
     # or with `curl`
     curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
    

    Verify that it is the correct file:

     sha256sum PowerPointViewer.exe
    

    If the checksum doesn’t match 249473568eba7a1e4f95498acba594e0f42e6581add4dead70c1dfb908a09423, then it’s not the right file. You can also save PowerPointViewer.exe.sha256 in the same directory and verify the checksum automatically with:

     sha256sum -c PowerPointViewer.exe.sha256
    

    which should return PowerPointViewer.exe: OK.

  2. Extract the font installer.

    You need a tool to extract the files from the executable. It may be possible to use unrar, but cabextract is a better match for this use-case.

    Install cabextract if you don’t have it.

     brew install cabextract
    

    Extract the part of the installer (ppviewer.cab) that has the fonts:

     cabextract PowerPointViewer.exe -F ppviewer.cab
    
  3. Extract the font files (i.e., .ttf, .ttc) into your user’s font directory and install fonts.

    • If you just want to install a specific font:

        # create a folder to extract font files
        mkdir -p /Users/menghan/Documents/PhD\ Courses/mac_setup/fonts/ppviewer
        # `-d` specifies the directory, otherwise will extract to the current folder, which is messy.
        cabextract ppviewer.cab -d /Users/menghan/Documents/PhD\ Courses/mac_setup/fonts/ppviewer
      

      Consolas is aimed for use in programming environments and other circumstances where a monospaced font is specified. It has four font styles:

      File name Styles & Weights
      CONSOLA.TTF Consolas Regular
      CONSOLAB.TTF Consolas Bold
      CONSOLAZ.TTF Consolas Bold Italic
      CONSOLAI.TTF Consolas Italic

      Two options you can install the fonts:

      • use open CLT or

        # install `consola` font family 
        open CONSOLA*.TTF
        

        A dialog shows, press Intall font. You will install four font styles (regular, italic, bold, bold italic) at once.

        Consolas font

      • double-click and install with the Font Book app

        The app allows a preview of the font you are installing, and it validate fonts to make sure no errors or no duplicate fonts are installed.

        Select multiple files and double-click will open all styles at once. Otherwise, you need to install per style separately.

      When you finish installing, the Font Book will show your fonts.

      Font Book

      Click the Details tab, you can see where the font is installed. For me, it’s /Users/menghan/Library/Fonts/CONSOLA*.TTF. Meaning the font is installed for the current user.

    • If you want to install all fonts contained in the installer:

      Deprecated ~/.fonts:

        mkdir -p ~/.fonts/ppviewer/
        cabextract ppviewer.cab -F '*.TTC' -d ~/.fonts/ppviewer/
        cabextract ppviewer.cab -F '*.TTF' -d ~/.fonts/ppviewer/
      

      In favor of the XDG Base Directory Specification, ~/.local/share/fonts.

      Unless you’re using a legacy application that doesn’t recognize the newer XDG spec, it’s recommended to use that instead of ~/.fonts:

        mkdir -p ~/.local/share/fonts/ppviewer/
        cabextract ppviewer.cab -F '*.TTC' -d ~/.local/share/fonts/ppviewer/
        cabextract ppviewer.cab -F '*.TTF' -d ~/.local/share/fonts/ppviewer/
      

      After this step, you may delete PowerPointViewer.exe and ppviewer.cab.

      If your font-using application is already open, it’ll probably need to be restarted before it can use the newly-installed fonts.

Ref:

Q: Why Consolas (code font) looks smaller than Verdana (body text font) even under the same font size? See below. The first line is in Verdana and the second is Consolas. Both 12pt. Consolas is slightly shorter.

Font Size

A: Consolas has a smaller x-height than Verdana. This is a font design issue.

Tip: The solution is to use matching fonts.

  • If you really want to use Verdana for copy text, Lucida Console is probably the best choice for a monospace font.
  • If you want to use Consolas as monospace font (fine!), then use another “C font” for copy text, such as Cambria (serif font) or Calibri or Candara (sans-serif fonts).

Q: Fonts are too small on some websites in Safari.
A: Preferences > Advanced > Accessibility, check the box Never use font sizes smaller than, I set it to 14 pt.


Finder

You can customize the view for a folder—for example, how you want to sort your files. Then you can choose to always use the customized view settings for just that specific folder.

  1. Choose the folder, ⌘+J to open View Options.
  2. Customize the view for the selected folder.

Ajust column width

Right-click the column separator icon and select from one of the options:

  • Right Size This Column (or double-click)
  • Right Size All Columns Individually
  • Right Size All Columns Equally

Finder Info Window

  • Comments add your file description here. It will work for spotlight searches.

Scroll bars

  • System Settings > Appearance > Show scroll bars, has 3 options

  • Choose When scrolling. This will hide scroll bars until you start scrolling. This looks minimalistic. 简洁风。

    Always and Automatically based ... looks cluttered. Thick heavy scroll bars show in Finder. More importantly, you can’t adjust column width by clicking anywhere on the column separator, you can only click the bottom.


Safari

Q: How to get icons in Safari favorites (aka favicons) to display correctly?
A: See post here: https://apple.stackexchange.com/a/294633.

Tips:

  • You can save the link with selected text. This is useful when you want to highlight some text in a webpage.

    Select your text then right-click, choose Copy Link with Highlight.

Chrome Extensions

  • Enable Copy

    偶尔会遇到一些网站把复制粘贴功能禁掉了,大多数应该是使用JavaScript代码实现的。如果确实需要复制网页上的文字,不必手打,可以使用Chrome浏览器的“Enable Copy”扩展来解除限制。或者,直接在网页权限里把脚本禁用就可以了

    插件使用方法:需要解除限制时,点击Enable Copy图标。当前网页和该网站下的所有网页都被解除限制。此时可以复制网页内容并粘贴到别处。

    据说有安全隐患…

Q: 如何在 Chrome 禁用脚本?

A: Open Chrome DevTools (opt+cmd+I or F12) > Open Command Palette (shift+cmd+P) > Type javascript, a dropdown menu show “Disable JavaScript”, press Enter. JavaScript is now disabled.

To remind you that JavaScript is disabled, Chrome shows the corresponding Disabled JavaScript. icon in the address bar and DevTools shows a warning Warning. icon next to Sources.

JavaScript will remain disabled in this tab so long as you have DevTools open.


Preview

Q: How to rotate a text box?
A: Select the text box, then hold down Command. With two fingers on the trackpad (forefinger and middle finger), keep one finger stationary (forefinger) and let the second finger rotate the textbox in whichever direction you want.