Extending keyguard.scad to support additional tablets

keyguard.scad can be extended to support new tablets.  There are two ways you can do this.

The first, and preferred way, would be for you to collect certain information about the tablet and then share it with us at Volksswitch.org.  We will then take that information and change the code of keyguard.scad to include the information you provide.  We will work with you to get a test keyguard constructed and in your hands so that you can test it.  If everything fits great, we’ll include support for the new tablet in our next official release.  Start by sending us a message via our Contact Us page.

The second way would be by  adding the measurements you’ve collected to the “other tablet general sizes” and “other tablet pixel sizes” fields in Special Actions and Settings.   You can verify the measurements you’ve collected by creating a keyguard and testing its fit.  Then you can decide to share the data you’ve collected with us for inclusion in the next official release or keep it to yourself.  That’s what Opensource is all about.

Getting all the Measurements

Regardless of which direction you choose, you’ll need all the tablet measurements that keyguard.scad cares about.  They include physical measurements of the tablet and specifics about the screen.  Take advantage of web resources like Wikipedia and the website of the tablet manufacturer to get as much information as you can.  You may need to email the manufacturer if you can’t get what you need online. Note that keyguard.scad needs measurements in millimeters not inches.  Often measurements in inches are just approximations.  The tablet is most likely manufactured in a country that exclusively uses metric measurements and that’s what we need. 

Finally note that the data embedded in keyguard.scad refers only to the tablet.  Case measurements are separate and entered by hand into the Customization pane.  If your tablet came with a case, as part of a system like a NovaChat or Accent system, don’t be concerned.  Just insert a zero for the measurements that you can’t obtain because of the case. Collect measurements for the case as well – like the case opening height and width – and share those with us.  We can post them on a page for that AAC system manufacturer.

For the purpose of these measurements, we assume that the tablet is placed in landscape mode.  Don’t be concerned if you will be using your tablet in portrait mode – you can specify that orientation when you actually create your keyguard design.

You’ll need to obtain:

  • Tablet Width – this is the overall, long measurement of the tablet, including any bezel.  If your system came with a case, set this value to zero.
  • Tablet Height – this is the short measurement of the tablet, including any bezel. If your system came with a case, set this value to zero.
  • Tablet Thickness – this is the thickness of the tablet, including any top bezel. If your system came with a case, set this value to zero.
  • Screen Width – this can be measured directly or calculated as the size of a pixel times the number of horizontal pixels.
  • Screen Height – this can be measured directly or calculated as the size of a pixel times the number of vertical pixels.
  • Left Border Width – measured from the left edge of the tablet (including any bezel) to the left edge of the screen.  If the screen is positioned exactly in the middle of the tablet from left to right then this is also (Tablet Width – Screen Width)/2.  But don’t make assumptions.  Go ahead and measure it.  Take this measurement when the tablet is displaying its home screen so it’s easy to tell where the border ends and the screen starts. If your system came with a case, set this value to zero.
  • Right Border Width – measured from the right edge of the tablet (including any bezel) to the right edge of the screen.  If the screen is positioned exactly in the middle of the tablet from left to right then this is also (Tablet Width – Screen Width)/2.  But don’t make assumptions.  Go ahead and measure it.  Take this measurement when the tablet is displaying its home screen so it’s easy to tell where the border ends and the screen starts. If your system came with a case, set this value to zero.
  • Bottom Border Height – measured from the bottom edge of the tablet (including any bezel) to the bottom edge of the screen.  If the screen is positioned exactly in the middle of the tablet from top to bottom then this is also (Tablet Height- Screen Height)/2.  But don’t make assumptions.  Go ahead and measure it.  Take this measurement when the tablet is displaying its home screen so it’s easy to tell where the border ends and the screen starts. If your system came with a case, set this value to zero.
  • Top Border Height – measured from the top edge of the tablet (including any bezel) to the top edge of the screen.  If the screen is positioned exactly in the middle of the tablet from top to bottom then this is also (Tablet Height- Screen Height)/2.  But don’t make assumptions.  Go ahead and measure it.  Take this measurement when the tablet is displaying its home screen so it’s easy to tell where the border ends and the screen starts. If your system came with a case, set this value to zero.
  • Distance from Edge of Screen to Center of Home Button –  the distance from the edge of the active area of the screen to the center of the home button.  If there is no home button on the top surface of the tablet then this value should be zero. We assume that the home button and camera (if they exist on the top surface of the tablet) are positioned at opposite ends of the long dimension of the tablet.  If they’re not, then set these values to zero and use cuts in “openings_and_additions.txt” to expose one or both of them. If the home button isn’t located on the front face of the tablet, set this value to zero.
  • Home Button Height– the distance across the face of the button from bottom to top.  If there is no home button then this value should be set to zero.  keyguard.scad assumes that the button will be round if this value is the same as the home button width.  If, instead, the home button height and width are different, the opening will be elongated into a hot dog shape.  If the home button isn’t located on the front face of the tablet, set this value to zero. 
  • Home Button Width– the distance across the face of the button from side to side.  If there is no home button then this value should be set to zero.  keyguard.scad assumes that the button will be round if this value is the same as the home button height.  If, instead, the home button height and width are different, the opening will be elongated into a hot dog shape.  If the home button isn’t located on the front face of the tablet, set this value to zero.
  • Home Button Location – this is a value from zero to four: 0 – the home button isn’t located on the front face of the tablet, 1 – the home button is positioned on the top edge of the tablet when in landscape mode, 2 – the home button is positioned on the right edge of the tablet when in landscape mode, 3 – the home button is positioned on the bottom edge of the tablet when in landscape mode, 4 – the home button is positioned on the left edge of the tablet when in landscape mode. 
  • Distance from Edge of Screen to Center of Camera – the distance from the edge of the active area of the screen to the center of the camera.  If there is no camera on the top surface of the tablet then this value should be set to zero.  If your system came with a case, set this value to zero.  You’ll need to use the “openings_and_additions.txt” file to create an opening for the camera.
  • Camera Height– the distance across the front-facing camera lens.  It’s OK to make this value a few millimeters larger than the actual size.  If you want to ensure that the camera opening includes other optical sensors next to the camera lens, include those elements in your measurements.  If the camera height is the same as the camera width, the opening will be circular.  If the two values differ, the opening will be elongated into a hot dog shape. If the camera isn’t located on the front face of the tablet, set this value to zero. 
  • Camera Width– the distance across the front-facing camera lens.  It’s OK to make this value a few millimeters larger than the actual size.  If you want to ensure that the camera opening includes other optical sensors next to the camera lens, include those elements in your measurements.  If the camera height is the same as the camera width, the opening will be circular.  If the two values differ, the opening will be elongated into a hot dog shape.  If the camera is accompanied by a light source and/or a light meter, you can use the hot dog shaped opening to expose these other functions.  On the other hand, if these additional features are located entirely to the left or right of the camera, and you want to expose them you’ll need to use the “case_openings” data structure to do so.  If the camera isn’t located on the front face of the tablet, set this value to zero. 
  • Camera Location – this is a value from zero to four: 0 – the camera isn’t located on the front face of the tablet, 1 – the camera is positioned on the top edge of the tablet when in landscape mode, 2 – the camera is positioned on the right edge of the tablet when in landscape mode, 3 – the camera is positioned on the bottom edge of the tablet when in landscape mode, 4 – the camera is positioned on the left edge of the tablet when in landscape mode.  If your system came with a case, set this value to zero. 
  • Tablet Corner Radius – exactly what it sounds like.  iPads normally have a 10 mm corner radius and non-iPad tablets typically have a 5 mm corner radius.  This value is only relevant for keyguards that won’t be going in a case.  If the AAC system comes with a case and you have to leave the tablet in the case then set this value to zero.

 

  • The Number of Vertical Pixels – you should easily be able to get this information from product documentation. We’re talking about the shorter dimension, so if your screen is 1024 pixels by 768 pixels, we’re referring to the 768 number.
  • The Number of Horizontal Pixels – you should easily be able to get this information from product documentation. We’re talking about the longer dimension, so if your screen is 1024 pixels by 768 pixels, we’re referring to the 1024 number.
  • Pixel Size – this is the width/height of a pixel in millimeters.  It’s the toughest measurement to get from product documentation, but if you can find it, it’s better than the alternative of dividing the screen width by the pixel width of the screen.  Avoid measurements like “pixels per inch” and “pixels per centimeter” because such numbers are just too inaccurate.  Pixels per millimeter might be OK.  Pixel size is just the inverse of that number .  If worse comes to worse, divide the screen width by the number of pixels that the screen is wide.  Check that value against the value you get by dividing the screen height by the number of pixels that the screen is high.

The following images may be helpful in understanding what the various measurements refer to on the tablet (click on an image to see it enlarged):

Adding your measurements in the Customizer

You’ll put your data into two fields in the Special Actions and Settings section of the Customizer.  18 of your measurements will go into the “other tablet general sizes” field and your 3 pixel related measurements will go in the “other tablet pixel sizes” field:

Note that you don’t have to just put integer measurements into these fields.  You can add numbers with decimal/fractional parts.

Arrange the following measurements together with a comma between each number:

  1. Tablet Width,
  2. Tablet Height,
  3. Tablet Thickness,
  4. Screen Width,
  5. Screen Height,
  6. Right Border Width,
  7. Left Border Width,
  8. Bottom Border Height,
  9. Top Border Height,
  10. Distance from edge of screen to Home Button,
  11. Home Button Height,
  12. Home Button Width,
  13. Home Button Location,
  14. Distance from edge of screen to Camera,
  15. Camera Height,
  16. Camera Width,
  17. Camera Location,
  18. Tablet Corner Radius

Now paste the string of numbers between the two brackets in the first field.  Press the enter key.

Next arrange the following measurements into another string separated by commas and paste the string between the brackets in the second field:

  1. # vertical pixels,
  2. # horizontal pixels,
  3. pixel size

When you’ve entered the data for your new tablet, select “other tablet”  at the end of the “type of tablet” pull down list: 

If your measurements are accurate, you should see a keyguard that looks reasonable – note that you may need to adjust the case opening measurements or set the value of “have a case” to “no”.

Test the dimensions for your new tablet (or case) quickly by printing a minimal keyguard.  This keyguard “mask” uses the “cut out screen” option at the bottom of the Special Actions and Settings section:

Enter all the information about your tablet and case.  Next, set “cut out screen” to “yes”.  Finally, set “keyguard thickness” in Free-form Keyguard Openings to something like 2 mm.

The result will be a keyguard that tests the critical measurements for your new tablet or case:

This mask will print relatively quickly and help you test your measurements for tablet height/width, case opening height/width, border thickness, tablet/case opening corner radius, screen height/width, and, finally, camera and home button location and size.

If the mask fits cleanly within the case opening and around the active area of the screen, you can focus confidently on your app layouts.

That’s it.  Save your design as a Preset with a name you can easily find again – at least until, you send your measurements to us and we incorporate your data directly into the designer.

Let us know if it’s a success!