diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index 8d3d9ec51d20..6b64093205aa 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -675,7 +675,13 @@ nsThebesDeviceContext::SetDPI() } } - dpi = gfxPlatform::GetDPI(); + dpi = gfxPlatform::GetDPI(); + +#ifdef MOZ_ENABLE_GTK2 + if (prefDPI < 0) // Clamp the minimum dpi to 96dpi + dpi = PR_MAX(dpi, 96); +#endif + if (prefDPI > 0 && !mPrintingSurface) dpi = prefDPI; }