title: Will the device context of a child window have the same text metrics and text extents as its parents (up to GA_ROOT) with the same HFONT?
body: <p>Right now I have code to manually compute the dialog base units for a non-dialog; these calculations involve getting a window's HDC and <a href="https://support.microsoft.com/en-us/kb/125681" rel="nofollow">extracting the text metrics for that HDC as well as the text extents for the base X unit</a>. This is used by parent controls that arrange and lay out children in a line, grid, etc.; the DLUs are used to conform to the sizing specifications provided by Microsoft in their (old) UI guidelines (not sure what the new ones say, if anything).</p>
  
  <p>However, my code right now is run on every parent window for every child window in the window tree. Not only is this inefficient, but it's also inconsistent: do I calculate the base units for the child or its parent when computing the size the child wants to be? (All children have the same font as the parent.)</p>
  
  <p>I could optimize this by assuming that if I select the same font into the HDC of a parent and the HDC of a child, the text extents and metrics will be identical. If this is true, then I can simply get these base units once, for the toplevel window that hosts all these children controls (<code>GetAncestor(GA_ROOT)</code>), and then use them through the entire control layout process. So <strong>is this true</strong>?</p>
  
  <p>If that is true, under what conditions will the values be likely to change, DPI/monitor change only? Or something else?</p>
  
  <p>And if that is not true, whose (parent's or child's) window dialog base units do I get for what (position and size)?</p>
  
  <p>(Note: I'm talking about parents and children, not owners and owned windows.)</p>
  
  <p>Thanks.</p>