How do I enable letterbox for my display

What I want:

I have a 21″ 16:9 Dell Monitor (as an external monitor for my laptop) that can support resolution upto 1920×1080. I want to use resolution 1680×1050 (aspect ratio 16:10) with letterbox on the sides. (In Windows this is an auto feature and changing stretched vs letterbox is provided in the Display settings.)

Image: 1680×1050 (16:10) resolution being stretched to fill 16:9 display

Added the Custom resolution

I have used the following command lines to add the new resolution (1680×1050) which was not there by default:

$   cvt 1680 1050 60 $   xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync $   xrandr --addmode HDMI1 "1680x1050_60.00" 

My quest to a letterbox

Then to have the letterbox, I have tried:

$ xrandr --output HDMI1 --transform 1,0,-100,0,1,0,0,0,1 (moved screen to right)

$ xrandr --output HDMI1 --size 1680x1050 --fb 1680x1050 (did nothing)

$ xrandr --output HDMI1 --mode "1680x1050_60.00" --scale 1.6x1 (stretched display)

$ xrandr --output HDMI1 --set "scaling mode" "Full aspect" (error)

xrandr –prop

running the following command line to get information on my displays:

xrandr --prop 

Note: HDMI1 is the external monitor. LVDS1 is the laptop screen.

output:

Screen 0: minimum 8 x 8, current 1680 x 1050, maximum 32767 x 32767 LVDS1 connected (normal left inverted right x axis y axis)     EDID:          00ffffffffffff004c83514500000000         00160104902213780a8da59d5b559c26         19505400000001010101010101010101         010101010101ce1d56f0500018304030         250058c210000019d81356f050001830         4030250058c210000019000000000000         00000000000000000000000000000002         000c4cff0a3c64151e32640000000023     BACKLIGHT: 3906          range: (0, 4882)     Backlight: 3906          range: (0, 4882)     scaling mode: Full aspect          supported: Full, Center, Full aspect     link-status: Good          supported: Good, Bad     non-desktop: 0          range: (0, 1)    1366x768      59.99 +  39.94      1360x768      59.96      1280x720      59.86    60.00    59.74      1024x768      60.00      1024x576      60.00    59.90    59.82      960x540       60.00    59.63    59.82      800x600       60.32    56.25      864x486       60.00    59.92    59.57      640x480       59.94      720x405       59.51    60.00    58.99      680x384       60.00      640x360       59.84    59.32    60.00   DP1 disconnected (normal left inverted right x axis y axis)     max bpc: 12          range: (6, 12)     Broadcast RGB: Automatic          supported: Automatic, Full, Limited 16:235     audio: auto          supported: force-dvi, off, auto, on     link-status: Good          supported: Good, Bad     non-desktop: 0          range: (0, 1) HDMI1 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 480mm x 270mm     EDID:          00ffffffffffff0010acb8d054364530         101b010380301b78eac7b5a756539c27         105054a54b00714f8180a9c0d1c00101         010101010101023a801871382d40582c         4500dc0c1100001e000000ff00525946         3337373448304536540a000000fc0044         454c4c205332323138480a20000000fd         00384c1e5311000a20202020202001f4         02031ef14b90050403021101141f1213         230907078301000065030c001000023a         801871382d40582c4500dc0c1100001e         011d8018711c1620582c2500dc0c1100         009e011d007251d01e206e285500dc0c         1100001e8c0ad08a20e02d10103e9600         dc0c1100001800000000000000000000         000000000000000000000000000000c1     max bpc: 12          range: (8, 12)     content type: No Data          supported: No Data, Graphics, Photo, Cinema, Game     aspect ratio: Automatic          supported: Automatic, 4:3, 16:9     Broadcast RGB: Automatic          supported: Automatic, Full, Limited 16:235     audio: auto          supported: force-dvi, off, auto, on     link-status: Good          supported: Good, Bad     non-desktop: 0          range: (0, 1)    1920x1080     60.00 +  50.00    59.94      1920x1080i    60.00    50.00    59.94      1600x900      60.00      1280x1024     75.02    60.02      1152x864      75.00      1280x720      60.00    50.00    59.94      1024x768      75.03    60.00      800x600       75.00    60.32      720x576       50.00      720x480       60.00    59.94      640x480       75.00    60.00    59.94      720x400       70.08      1680x1050_60.00  59.95*  VGA1 disconnected (normal left inverted right x axis y axis)     link-status: Good          supported: Good, Bad     non-desktop: 0          range: (0, 1) VIRTUAL1 disconnected (normal left inverted right x axis y axis)     non-desktop: 0          supported: 0, 1 

As you can see, my HDMI1 display does not support scaling mode (that LVDS1 does). But I know that letterbox is possible for this monitor as I have done so in Windows 10.

Conclusion

I obviously must be overlooking something and this is just taking too damn long to figure out. Any help would be appreciated.

Creating a letterbox screen for Android devices

I want that the screen looks the same on every Android device without distorting the sprites.

One player should not see more of the map than another player just because they have a bigger screen or different resolution on their device.

I use (1334, 750) as my virtual resolution and only landscape mode is supported. But at the moment, you can see more of the map on top and on the bottom if you have a device with different aspect ratio.

How would I create a letterbox on top and on the bottom so that the visible game window keeps the same aspect ratio and portion of the game world visible on every device?

Do I need to modify my 2D camera when I create a letterbox screen?

At the moment it looks like this:

Android emulator

But it should look like this so that everyone can see the same map on the screen:

Letterboxed

 public class Game1 : Game     {         GraphicsDeviceManager graphics;         SpriteBatch spriteBatch;         Camera camera;         Vector2 vp, gameWorldSize = new Vector2(1334, 750);          float ScaleX, ScaleY, Scale;         Vector2 Newcameraposition;         Texture2D Background;                   public Game1()         {             graphics = new GraphicsDeviceManager(this);             Content.RootDirectory = "Content";             graphics.IsFullScreen = true;             graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;         }          protected override void Initialize()         {             base.Initialize();         }          protected override void LoadContent()         {             spriteBatch = new SpriteBatch(GraphicsDevice);             Background = Content.Load<Texture2D>("background");                           vp = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);             ScaleX = vp.X / gameWorldSize.X;             ScaleY = vp.Y / gameWorldSize.Y;             Scale = Math.Min(ScaleX, ScaleY);                            camera = new Camera(new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2), Scale, vp);         }          protected override void Update(GameTime gameTime)         {             Newcameraposition = new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2);             camera.Update(gameTime, Newcameraposition, Scale, vp);              base.Update(gameTime);         }          protected override void Draw(GameTime gameTime)         {             GraphicsDevice.Clear(Color.CornflowerBlue);              spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.GetMatrix());             spriteBatch.Draw(Background, new Rectangle((int)gameWorldSize.X / 2, (int)gameWorldSize.Y / 2, Background.Width, Background.Height), null, Color.White, 0, new Vector2(Background.Width / 2, Background.Height / 2), SpriteEffects.None, 0.0f);                      spriteBatch.End();                  base.Draw(gameTime);         }     } 

My 2D camera:

 public class Camera     {         public Vector2 PlayerPosition;         private Vector2 Viewport;         private float Scale;          public Camera(Vector2 playerposition, float scale, Vector2 viewport)         {             PlayerPosition = playerposition;             Scale = scale;             Viewport = viewport;         }          public void Update(GameTime gameTime, Vector2 playerposition, float scale, Vector2 viewport)         {             PlayerPosition = playerposition;             Scale = scale;             Viewport = viewport;         }          public Matrix GetMatrix()         {             return Matrix.CreateTranslation(new Vector3(-PlayerPosition.X, -PlayerPosition.Y, 0))          * Matrix.CreateScale(Scale, Scale, 1)          * Matrix.CreateTranslation(Viewport.X / 2, Viewport.Y / 2, 0);         }     }